For Loop using values from x axis

My x axis has values ranging from -400 to 400
i want to create a for loop which tests whether each xvalue is bigger or smaller than positive/negative 24.
is there a way, perhaps an array?, with which i can do it

댓글 수: 1

Parveiz Lone
Parveiz Lone 2020년 6월 4일
For x=-400:400 if (×》24) % 》=greater than Disp(x) End End

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

답변 (1개)

Takumi
Takumi 2020년 6월 4일
편집: Takumi 2020년 6월 4일

0 개 추천

For example, you can check whether x is greater than 24 without using for loops.
x=-400:400;
x(x>=24)
When using a for loop
x=-400:400;
for i=1:length(x)
if x(i)>=24
disp(x(i));
end
end

카테고리

도움말 센터File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

제품

질문:

2020년 6월 4일

편집:

2020년 6월 4일

Community Treasure Hunt

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

Start Hunting!

Translated by