A=[1 1;2 2;3 3;4 4;5 5;6 6;7 7;8 8;9 9;10 10;11 11;12 12;13 13]B=[3;4;3;3]
%I need to create this loop w.r.t A and B.
x1=A(1:B(1),:) x2=A(B(1)+1:B(1)+B(2),:)x3=A(B(1)+B(2)+1:B(1)+B(2)+B(3),:)x4=A(B(1)+B(2)+B(3)+1:B(1)+B(2)+B(3)+B(4),:)
for loop
A=[1 1;2 2;3 3;4 4;5 5;6 6;7 7;8 8;9 9;10 10;11 11;12 12;13 13]B=[3;4;3;3]
x1=A(1:B(1),:) x2=A(B(1)+1:B(1)+B(2),:)x3=A(B(1)+B(2)+1:B(1)+B(2)+B(3),:)x4=A(B(1)+B(2)+B(3)+1:B(1)+B(2)+B(3)+B(4),:)
Best Answer