How to display which number in a string of text applys to an if command?

2 ビュー (過去 30 日間)
Et.B200
Et.B200 2020 年 11 月 8 日
コメント済み: Star Strider 2020 年 11 月 10 日
Hi, everyone,
I have a string of numbers and want to apply an if command on all the numbers in the text, for example if a number is equal to or less than 2 within this text, and if it is, I want the function to display and identify this number by how far down in the string of numbers it is.
eg out of these numbers I want the command to then output 4, 6 and 7
12
35
46
1
4
1.3
0

採用された回答

Star Strider
Star Strider 2020 年 11 月 8 日
Try this:
v = [12
35
46
1
4
1.3
0];
loc = find(v <= 2)
producing:
loc =
4
6
7
.
  2 件のコメント
Et.B200
Et.B200 2020 年 11 月 8 日
Thank you very much sir :)
Star Strider
Star Strider 2020 年 11 月 8 日
As always, my pleasure!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by