How to display which number in a string of text applys to an if command?
조회 수: 3 (최근 30일)
이전 댓글 표시
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
2020년 11월 8일
Try this:
v = [12
35
46
1
4
1.3
0];
loc = find(v <= 2)
producing:
loc =
4
6
7
.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Characters and Strings에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!