Hello,
I have the following assignment:
1.3 Generate a cell with ten elements. Each element is a vector of random length (between 1 and 10) containing ones if the length is odd and zeros if the length is even.
For which I've been given the following solution:
NumofVec = 10; for 1 = 1:NumofVec; Vlen = floor(rand*10)+1; V{i} = ones (1, Vlen)*rem(Vlen,2); end
Could you please explain to me the meaning of the last two lines?
Vlen = floor(rand*10)+1; V{i} = ones (1, Vlen)*rem(Vlen,2);
Thanks a lot!
Massive thanks to anyone attempting to help!!
Silvi
Best Answer