How to extract columns number 1 and 3 from a matrix with 3 columns, to form a new matrix with 2 columns, without selecting columns number 2

475 views (last 30 days)
Guys, I have a 10 x 3 matrix and I want to know how to extract the 1st and the 3rd column from my matrix, to form a new 10 x 2 matrix, without selecting the 2nd column.
Regards

Accepted Answer

Image Analyst
Image Analyst on 28 Nov 2016
Try this:
m2 = m(:, [1,3])

More Answers (2)

Andrei Bobrov
Andrei Bobrov on 28 Nov 2016
out = your_matrix(:,[1,end])

Cris LaPierre
Cris LaPierre on 26 Oct 2020
Chapter 5 of MATLAB Onramp.

Community Treasure Hunt

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

Start Hunting!