For Loop with two constraints

조회 수: 3 (최근 30일)
Mo
Mo 2012년 9월 2일
Hi everyone, I have a really simple question.
How can I write a 'For' loop with two constraints :
  1. y1>f(y2) - function f is known
  2. y2= a:b
I write that :
for y2=a:b
for y1>f(y2) - it does not seem to work
P=X
end
end
Thanks,
  댓글 수: 2
Image Analyst
Image Analyst 2012년 9월 2일
Next time, you can highlight your code and click the "{} Code" icon above to format your code properly. I did it for you this time. For your problem, you used "for y1..." instead of "if y1..."
Mo
Mo 2012년 9월 2일
Ok. Thanks

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

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2012년 9월 2일
for y2=a:b
if y1>f(y2)
%do whatever
end
end

추가 답변 (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