fastest way to divide a matrix columns into two matrices ?

2 views (last 30 days)
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 ?

Accepted Answer

Azzi Abdelmalek
Azzi Abdelmalek on 20 Mar 2015
Edited: Azzi Abdelmalek on 20 Mar 2015
%If A is your matrix
A=randi(10,5,8) % example
c5=A(:,5) % the fifth column
B=A(:,[1:4 6:m]) % remaining matrix

More Answers (0)

Categories

Find more on Resizing and Reshaping Matrices in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!