Conditional statement of matrix
1 回表示 (過去 30 日間)
古いコメントを表示
hello
I have the following dataset
A
1
2
2
3
4
5
6
7
5
.
.
.
n
I want to write a conditional statement that will go through the rows and if it identify a given number ( for instance K = 7 ) it stops
and continues until the 7 is identified.
my code is not working as I
for n = (1:2)
if find(x > K,1,'first')
disp([' WARNING' num2str(n)])
else
disp(' No warning signs ')
continue
end
end
Help please
Tino
0 件のコメント
回答 (1 件)
madhan ravi
2019 年 5 月 16 日
n=find(A==k) % no loop is needed if you want to know the instances of the satisfied condition
2 件のコメント
madhan ravi
2019 年 5 月 16 日
編集済み: madhan ravi
2019 年 5 月 16 日
assert(~any((X > K)|(X < K)),'Uhoo found the guy')
参考
カテゴリ
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!