MATLAB: How to select desired row

MATLABselect row

I have a workspace A with value 81536×10 double. I want to take create new workspace from workspace A with row 1 to 112, 225 to 336, 449 to 560 and so on.

Best Answer

ix = [0:224:81563]' + 1:112 ; % calculate row indices
ix(ix>size(A,1)) = [] % remove row indices that are too larger
A2 = A(ix, :) % a single array
Alternatively, you can store each section in a cell array
A3 = arrayfun(@(k) A(k:k+111, :), 1:224:81563, 'un', 0) % no check of indices