I have matrix like below
A=[ 1 2 3 4 5 6 7; 8 9 10 11 12 13 14; 15 16 17 18 19 20 21];start=[1 3 4]; rowSize=2;
if I use for loop,
B=zeros(3,3);for i=1:3 B(i,:)=A(i,start(i):start(i)+rowSize);end
This will give
B = 1 2 3 10 11 12 18 19 20
Is ther anyway I can do the same process without using the for loop?
Best Answer