Hello, I have a vector called M, in which there are several numbers. I need to divide it in some sub vectors (y) of different size without changing the order of the data in M. The subvector ends when it is reached a number lower than the previous. this one is the first number of the next subvector
M=[2.24;2.28;2.31;0.99;1.44;1.44;1.44;1.44; 2.12;2.25;2.48;3.61;1.86;1.89;1.89;1.89;1.89;1.89;1.89];for j=1:(length(M(:))-1)if M(j)>M(j+1)else y(j)=M(1:j); endend
Finally I should obtain the following vectors but the code doesn't work
y1=[2.24;2.28;2.31]
y2=[0,99;1.44;1.44;1.44;1.44;2.12;2.25;2.48;3.61]
y3=[1.86;1.89;1.89;1.89;1.89;1.89;1.89];
Best Answer