MATLAB: Fastest way to divide a matrix columns into two matrices columndividematrix Hi All I have an m*n matrix I want to take out the fifth column (all the m rows) to one matrix , and alll of the other collumns , to another , how to do that ? Best Answer %If A is your matrixA=randi(10,5,8) % examplec5=A(:,5) % the fifth columnB=A(:,[1:4 6:m]) % remaining matrix Related SolutionsMATLAB: Assigning matrix values using lists of 2-way coordinates If the matrix exists already,matrix( sub2ind( size(matrix), row,col) ) = values MATLAB: Divide elements between 2 matrices M1 =[4 3 6 8 1 10 5 2 9 4 5 6 1 10 3 9 4 2 5 7 6 5 4 3 9 5 1 7 8 10 3 4 2 6 5 1];M2 =[1 6 3 5 3 5 9 6 2 1 9 5];[n,m]=size(M1);a=reshape(M1,n,4,[]);b=bsxfun(@rdivide, a,M2);out=b(:,:) Related QuestionI want to enter a matrix into a zero matrix except one rowSelecting random number from martrixMatrix row/column augmentationDividing stream
Best Answer