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
  1 件のコメント
Mo
Mo 2012 年 9 月 2 日
Thanks

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by