extracting values from matlab double arrays

조회 수: 7 (최근 30일)
sam
sam 2023년 1월 12일
댓글: Steven Lord 2023년 1월 12일
I have bunch of x1, x2, ... xn values as such as given below. I want to only extract those values for x1, x2, ..., xn only if values are <=1.5. How can I use for loop to do it? Could you kindly help? Thank you.
x1 =
0.1318
0.6027
0.7553
0.9645
1.0216
1.3936
1.4632
1.7074
1.8658
1.9327
x2=
0.0109
0.0301
0.0947
0.5086
0.6148
0.6889
0.7736
0.9207
1.0645
1.2933
1.4033
1.5021
1.6798
1.8843
1.9660
1.9904

채택된 답변

Cameron
Cameron 2023년 1월 12일
x1(x1 <= 1.5)
x2(x2 <= 1.5)
%...
xn(xn <= 1.5)
  댓글 수: 3
sam
sam 2023년 1월 12일
Thank you. It helps
Steven Lord
Steven Lord 2023년 1월 12일
Can you dynamically create variables with numbered names like x1, x2, x3, etc.? Yes.
Should you do this? The general consensus is no. That Answers post explains why this is generally discouraged and offers several alternative approaches.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by