if i==any elements in M
1 回表示 (過去 30 日間)
古いコメントを表示
Say I have a nX1 matrix M, i want to use condition, "if i==any elements in M", what should I type in Matlab?
0 件のコメント
採用された回答
Star Strider
2015 年 3 月 19 日
You’re almost there!
Try this:
M = randi(100, 250, 1);
k = 42;
if any(M == k)
fprintf('\n\t\t\tEUREKA!\n')
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!