MATLAB: How to take a rectangular matrix of numbers and turn it into a matrix of the form (row, column, number) columnindexingmatrixrelabellingrow I want to take a matrix of around 300 rows and 300 columns and put it into the form (row, column, number) Any help would be appreciated a lot. Thanks 🙂 Best Answer If m is your matrix:m=rand(3,2);[1+mod(0:numel(m)-1,size(m,1))' 1+fix((0:numel(m)-1)/size(m,1))' m(:)] Related SolutionsMATLAB: How to delete a row from a matrix If ‘M’ os your matrix, this works:M = M(M(:,3)==1, :) MATLAB: How to store values of rows in a matrix where the 3rd column is a multiple of 100 Use can use rem() to filter the rows where the third column is multiple of 100 and then use logical indexingM; % nx3 matrixidx = rem(M(:,3),100)==0;M_new = M(idx, :); Related QuestionCreate a matrix from columns of larger matrix with specific numbersHow to check if all the numbers in a column of a matrix are equal and return that valueAccessing var content in column, not locationHow to extract row, column, slice for image spect
Best Answer