How to eliminate certain columns from a matrix
172 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hatake nara
le 13 Juin 2019
Réponse apportée : Manvi Goel
le 13 Juin 2019
If I need to remove any column how do I do it?
For example:
s is a mxn matrix.I need to remove the odd columns i,e, the 1st,3rd.. columns.
0 commentaires
Réponse acceptée
Plus de réponses (1)
Manvi Goel
le 13 Juin 2019
Let the matrix be a.
You can remove the odd columns of a matrix by :
a(:,1:2:end) = []
% 1:2:end runs a loop from 1 till the numbe rof columns, increments the index by 2 every time and
% empties the column with that index.
Or use the following command to remove and column with index 'i'
a(:, i) = []
0 commentaires
Voir également
Catégories
En savoir plus sur Logical 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!