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?
Best Answer