matrix column element limiting
1 回表示 (過去 30 日間)
古いコメントを表示
hi,
I have a matrix say 200*30. I need to limit the elements of 29th and 30th columns with different constraints. how can I do that?
thanks,
0 件のコメント
採用された回答
Azzi Abdelmalek
2015 年 7 月 8 日
Example
A=rand(200,30)
idx=A(:,29)>0.5 & A(:,30)<0.7
out=A(idx,:)
4 件のコメント
Stephen23
2015 年 7 月 8 日
編集済み: Stephen23
2015 年 7 月 8 日
Azzi Abdelmalek's solution is much more optimized than using a loop. This is how MATLAB works best, using basic code vectorization and indexing.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!