Does available funtion in Matlab can extract rows satisfied a condition?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
binh23294
am 28 Sep. 2020
Kommentiert: binh23294
am 28 Sep. 2020
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 Kommentare
Akzeptierte Antwort
Ameer Hamza
am 28 Sep. 2020
Bearbeitet: Ameer Hamza
am 28 Sep. 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, :);
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Multidimensional Arrays 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!