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

442 vues (au cours des 30 derniers jours)
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

Réponse acceptée

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

Plus de réponses (2)

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

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

Catégories

En savoir plus sur Matrix Indexing dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by