For Loop with two constraints

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 comentarios

Image Analyst
Image Analyst el 2 de Sept. de 2012
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 el 2 de Sept. de 2012
Ok. Thanks

Iniciar sesión para comentar.

 Respuesta aceptada

Azzi Abdelmalek
Azzi Abdelmalek el 2 de Sept. de 2012

0 votos

for y2=a:b
if y1>f(y2)
%do whatever
end
end

Más respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

Mo
el 2 de Sept. de 2012

Community Treasure Hunt

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

Start Hunting!

Translated by