|
On Sep 10, 4:05=A0pm, "Yuri Geshelin" <geshe...@hotmail.com> wrote:
> Hi,
>
> In this writing, I assume that by "iteration" you mean a pass of the loop=
, not call(s) to one of the 15-20 functions.
>
> Let *flag* be an output argument of function #12:
>
> [........, flag, ......] =3D function_12(...)
>
> Next, write the following in the body of function_12:
>
> if variable=3D=3D0, flag =3D -98989; return, end
>
> (Also don't forget to assign a different value to 'flag' if variable is n=
ot zero).
>
> Once variable=3D=3D0, function_12 will terminate, and the loop will conti=
nue.
>
> Immediately after the call to function_12, write this:
>
> if flag =3D=3D -98989, continue, end
>
> This will skip the rest of the loop, and the next iteration will start.
>
> Yuri
>
> LindsE <LindsEHill...@gmail.com> wrote in message <110f6c3c-dfd9-43c5-97d=
8-3dae743c8...@25g2000hsx.googlegroups.com>...
> > Hi there;
>
> > I have a series of several functions running within a large loop and
> > would like Matlab to proceed to the next value in the loop if a
> > certain condition exists.
>
> > For example:
>
> > I run a calling function that calls about 15 - 20 other functions
> > within a loop (111 iterations). Within function #12, if a variable =3D
> > 0, I want Matlab to stop the iteration and return to the calling
> > function taking the next iteration and running until the condition is
> > met again.
>
> > Is there a function that can do this? Right now I'm using:
> > =A0 =A0 =A0 =A0 warning('Required data may be out of grid''s bounds')
> > =A0 =A0 =A0 =A0 dbstop if warning
>
> > but that won't allow the function to continue with the next
> > iteration. =A0Is it possible to use a "try"/"catch" such that
> > try
Very clever! Thank you so much! That'll work like a charm.
|