selective remove lines from array
10 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
hi !! some function for this small problem thank you
0 commentaires
Réponses (1)
Geoff Hayes
le 7 Mai 2014
Firas - if you have a matrix like the following:
Z =
1 6 11 16 21
2 7 12 17 22
3 8 13 18 23
4 9 14 19 24
5 10 15 20 25
You can remove the 3rd column (say) by simply typing:
% the colon indicates all row elements in the third column should be
% set to the empty matrix (which removes that column)
Z(:,3) = []
Z =
1 6 16 21
2 7 17 22
3 8 18 23
4 9 19 24
5 10 20 25
To remove the 4th row, you do something similar:
Z(4,:) = []
Z =
1 6 16 21
2 7 17 22
3 8 18 23
5 10 20 25
The above is just one way to remove a row or column (line) from a matrix (array).
0 commentaires
Voir également
Catégories
En savoir plus sur Operators and Elementary Operations 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!