In GNU Octave, I can use the following code to get every 5th row of X.
How do I get another matrix X_2 that consists of the rows that have not been extracted or left behind in X?
X = [1;2;3;4;5;6;7;8;9;10;11]
ix = ( 5 : 5 : size(X,1) )
X_1 = X( ix , : )
I want X_2 to have everything but 5 and 10. Is this possible?
Gnu Octave, Get every nth row of a matrix/vector:
prints:
Now, remove rows from the original matrix which will give you a list of the rows not extracted.
Example, remove row 5 and 10 from X:
Prints X with 5 and 10 missing:
So that proves concept. Use your ix variable to do it on the specified columns:
That will make X a list of the rows that have not been extracted. If you need to not disturb the original, make a copy of X and put it into another variable before you do this. Then assign
X_2 = X;Source:
Remove a column from a matrix in GNU Octave