Does available funtion in Matlab can extract rows satisfied a condition?
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I want to create a matrix has rows has first column value = 4 from matrix a; like


Does available funtion in Matlab can extract rows satisfied a condition? Thanks so much!
0 Commenti
Risposta accettata
Ameer Hamza
il 28 Set 2020
Modificato: Ameer Hamza
il 28 Set 2020
Read about array indexing: https://www.mathworks.com/company/newsletters/articles/matrix-indexing-in-matlab.html and https://www.mathworks.com/help/matlab/math/array-indexing.html
a = [4 5 6;
4 5 6;
5 5 6];
idx = a(:,1)==4;
b = a(idx, :);
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Creating and Concatenating 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!