Evaluate first column data, set remaining columns to zero based on first column value.
1 回表示 (過去 30 日間)
古いコメントを表示
I have a matrix of data, several rows, 4 columns and I want to look at the first column value and if it is above or below a certain value, set all the remaining columns in that row to zero. Sounds simple, but struggling to figure it out.
0 件のコメント
採用された回答
Walter Roberson
2017 年 4 月 26 日
mask = YourMatrix(:,1) > TheHighCutoff | YourMatrix(:,1) < TheLowCutoff;
YourMatrix(mask,2:end) = 0;
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Get Started with MATLAB についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!