End function when a value is reached

3 visualizaciones (últimos 30 días)
Greg
Greg el 1 de Feb. de 2012
Say I have a function f(t). T is a vector that i would like from [0:Condition]. I want to run f(t) for values up until f(t) meets a condition. for example y=2t and I am trying to find the value of t when (51-y)<1 who would i write this code. I know I can solve for t in this example but thats not an option for my function. Without knowing when to end t=[0:?] I can't figure out how to do this. Can you show me an example with the example above? Thanks in advance, Greg

Respuesta aceptada

Sean de Wolski
Sean de Wolski el 1 de Feb. de 2012
You could use a while-loop with the condition or a for-loop that contains an if condition met, break.
doc while
doc for
doc if
doc break
  1 comentario
Greg
Greg el 1 de Feb. de 2012
Can you show me for the above example I'm having a lot of trouble still

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Logical en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by