Find entire rows in a matrix where a column value meets a certain condition
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
David Carver
il 19 Ott 2016
Commentato: David Carver
il 19 Ott 2016
I have a matrix (4columns, ~50000 rows) and I want a new matrix that will only return the (entire) rows (values, not row number) where column 4 = 101300 (to 4s.f).
Any help appreciated.
VLE1(ii,:)=[x1 x2 T P]
0 Commenti
Risposta accettata
Guillaume
il 19 Ott 2016
filteredmatrix = originalmatrix(round(originalmatrix(:, 4), 4, 'significant') == 101300, :);
is all that is needed.
Più risposte (1)
Massimo Zanetti
il 19 Ott 2016
Assume your 50000x4 matrix is A, this will remove all the rows such having 4th element = 101300:
A(A(:,4)~=101300,:)=[];
0 Commenti
Vedere anche
Categorie
Scopri di più su Operating on Diagonal Matrices in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!