MATLAB: Rearrange a matrix into a vector by blocks MATLAB How can I rearrage the folloing matrix into a vector [1 2 3 4 5 … 36] without using for loops? Best Answer M = [1,3,13,15,25,27;2,4,14,16,26,28;5,7,17,19,29,31;6,8,18,20,30,32;9,11,21,23,33,35;10,12,22,24,34,36]M = 6×6 1 3 13 15 25 27 2 4 14 16 26 28 5 7 17 19 29 31 6 8 18 20 30 32 9 11 21 23 33 35 10 12 22 24 34 36 V = reshape(permute(reshape(M,2,3,2,[]),[1,3,2,4]),1,[])V = 1×36 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 28 29 30 Related SolutionsMATLAB: Reshape an array into another 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 28 29 30 31 32];a = [a(:,1:end/2);a(:,end/2+1:end)] MATLAB: Array rearrangement A = A(:); %column-wise extractivonor for more fancy manipulations:doc permutedoc transposedoc reshape Related QuestionConvert string to number or arrayHow to rearrange the rows of a matrixHow to rearrange subsystem block ports
Best Answer