Does available funtion in Matlab can extract rows satisfied a condition?
2 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
採用された回答
Ameer Hamza
2020 年 9 月 28 日
編集済み: Ameer Hamza
2020 年 9 月 28 日
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, :);
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!