How to delete rows while maintaining the indexes?
Afficher commentaires plus anciens
I'm trying to represent a tree of arrays in a matrix, like this: m(2,:) and m(3,:) are the children of m(1,:), m(4,:) and m(5,:) are the children of m(2,:) and so on.
Now I want to delete some rows from the memory, while maintaining the indexes. For example: I have a matrix m=[1 2 3; 2 4 6; 3 6 9] and I want to delete row 2, so the result is: m=[1 2 3; ; 3 6 9].
Yes, I want the deleted row to count, because I have a lot of indexes pointing to the other rows, but not to consume memory.
I tried m(2,:)=[], but this way I lost the indexe. I mean, row 3 became row 2. Any ideas?
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Matrix Indexing 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!