I have an array StartMeasuring,
which is filled with 10 numbers. I would like to fill the matrix Depth
with 10 arrays counting down to zero from the numbers in StartMeasuring.
StartMeasuring=randi([10 30],1,10);
lenDepth =len(StartMeasuring);
Depth=NaN(lenDepth,30);
for i=1:lenDepth
Depth(i)=StartMeasuring(i):-1:0;
end
I tried to create a for loop and replacing a matrix with NaN
's, but I get the error :
Unable to perform assignment because the left and right sides have a different number of elements.
Error in sd (line 53)
Depth(i)=StartMeasuring(i):-1:0;
I don't understand why I get this error since both Depth
and StartMeasuring
are size 10.