How to exclude more than 1 columns from a matrix?
Afficher commentaires plus anciens
I have a matrix like this: Data = [2,1,4,6,2;9,4,6,1,2;5,3,2,8,3;7,2,1,9,3;7,1,8,2,4]
2 1 4 6 2
9 4 6 1 2
5 3 2 8 3
7 2 1 9 3
7 1 8 2 4
then i want to exclude the column 3 and 5 from my new matrix. So it will be like this:
2 1 6
9 4 1
5 3 8
7 2 9
7 1 2
what to do? thanks before :')
Réponse acceptée
Plus de réponses (1)
Andrei Bobrov
le 27 Avr 2012
Data = [2,1,4,6,2;9,4,6,1,2;5,3,2,8,3;7,2,1,9,3;7,1,8,2,4]
out = Data(:,[1 2 5])
4 commentaires
Isti
le 27 Avr 2012
Andrei Bobrov
le 27 Avr 2012
out = Data(:,setdiff(1:size(Data,2),[3 5]))
Andrei Bobrov
le 27 Avr 2012
Data(:,[3 5])=[]
Isti
le 28 Avr 2012
Catégories
En savoir plus sur Logical dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!