MATLAB: How to split an array by same length and make a matrix arraymatrix I have an array. a=[1 2 3 4… 24 25 26 27… 48 49 50… 72] I want a matrix from that array. i.e. b=[1 2 3… 24; 25 26 27… 48; 49 50 51… 72] After 24 interval it will be in next row. small code is preferable. Best Answer >> a = 1:72;>> b = reshape(a,24,[]).'b = 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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 Related SolutionsMATLAB: How to rearrange the rows of a matrix The trick is to use the index from sorting the first column:[~,idx] = sort(A(:,1));B = A(idx,:); MATLAB: Warning: Matrix is singular to working precision. You start with a 72 x 72 matrix. You assemble 43 times, so the matrix gets up to rank 43. You have 18 boundary conditions.The solve code removes the entries referred to by the boundary conditions, so it gets down to (72-18) = 54 x 54.But only 43 of those 54 have meaningful data. The result is going to be a singular matrix.Perhaps you should have 29 boundary conditions instead of 18. Related QuestionReshaping array horizontally elementwiseTransform matrices into a single matrixHow to make each pair of pixels from the matrix in a row major orderCombine two matrices into oneI wanted to read .dcm files for the project from a folderRows mean collapse in big matrix
Best Answer