How can I check if a condition holds?
1 回表示 (過去 30 日間)
古いコメントを表示
I want to find the elements where the following condition holds: 0<x and y=1.
x and y are arrays. How can I find the rows where both conditions hold at the same time?
0 件のコメント
回答 (1 件)
Image Analyst
2018 年 6 月 5 日
編集済み: Image Analyst
2018 年 6 月 5 日
You can say this:
indexes = (x > 0) & (y == 1)
outputArray = inputArray(indexes);
What shape are your x, y, and input array? 1-D vector? 2-D matrix?
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!