using function to remove elements from a large matrix
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Malik Khan
am 25 Dez. 2019
Bearbeitet: Malik Khan
am 3 Jan. 2020
I need to code for a matrix in which the rows are removed given thier value in a certain column is not of desire to me. eg, I want to keep the numbers 1 2 3 and 11 and 12 but not 4 5 6 or 13 14 etc.
3 Kommentare
Akzeptierte Antwort
the cyclist
am 25 Dez. 2019
Bearbeitet: the cyclist
am 25 Dez. 2019
idxToKeep = ismember(M(:,2),[1,2,3,11,12]);
M = M(idxToKeep,:);
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Resizing and Reshaping Matrices finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!