How to store values of rows in a matrix where the 3rd column is a multiple of 100?
1 回表示 (過去 30 日間)
古いコメントを表示
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 件のコメント
採用された回答
Ameer Hamza
2020 年 12 月 5 日
編集済み: Ameer Hamza
2020 年 12 月 5 日
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, :);
その他の回答 (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!