How to store values of rows in a matrix where the 3rd column is a multiple of 100?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
AJA
am 5 Dez. 2020
Kommentiert: Ameer Hamza
am 5 Dez. 2020
I have a matrix with 3 columns and a large number of rows. In order to reduce the rows, I need to keep the rows whose 3rd column value is a multiple of 100 and store it in as a new matrix. How do I do that?
0 Kommentare
Akzeptierte Antwort
Ameer Hamza
am 5 Dez. 2020
Bearbeitet: Ameer Hamza
am 5 Dez. 2020
Use can use rem() to filter the rows where the third column is multiple of 100 and then use logical indexing
M; % nx3 matrix
idx = rem(M(:,3),100)==0;
M_new = M(idx, :);
2 Kommentare
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!