How to cut a matrix in Matlab? -


i transform matrix a matrix b without using cells (e.g. mat2cell) in matlab, where

a=[1 2 3;     4 5 6;     7 8 9;     10 11 12;     13 14 15;     16 17 18;     19 20 21;     22 23 24;     25 26 27];  b=[1 2 3 10 11 12 19 20 21;    4 5 6 13 14 15 22 23 24;     7 8 9 16 17 18 25 26 27]; 

all need reshape + permute magic -

n = 3;  %// cut after every n rows , looks no. of columns in b = reshape(permute(reshape(a,n,size(a,1)/n,[]),[1 3 2]),n,[]) 

Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -