Re: Trouble using the OR operator within a 'while' loop...
- From: matlab_rookie <matthewdodds86@xxxxxxxxxxxxx>
- Date: Mon, 31 Mar 2008 09:24:55 -0700 (PDT)
On Mar 31, 5:13 pm, Randy Poe <poespam-t...@xxxxxxxxx> wrote:
On Mar 31, 11:54 am, matlab_rookie <matthewdodd...@xxxxxxxxxxxxx>
wrote:
On Mar 31, 4:35 pm, ImageAnalyst <imageanal...@xxxxxxxxxxxxxx> wrote:
Try this
while max(totalconcentration) < 50000 || max(totalconcentration2) <
50000
Note the double |.
Good luck,
ImageAnalyst
Thank again,
This has worked to a certain extent. Whats happening now is, the
simulation is running until both of the rovers have reached a value
above 50000....when really what im wanting is for the simulation to
stop once either of them has reached a value above 50000.
Change the || to &&.
You want to stop if either is >= 50000. So by de Morgan's
laws, you want to continue if both are < 50000. The
negation of (A || B) is (not A && not B).
- Randy
Awesome guys, thanks very much got it working! :)
.
- Follow-Ups:
- Re: Trouble using the OR operator within a 'while' loop...
- From: matlab_rookie
- Re: Trouble using the OR operator within a 'while' loop...
- References:
- Trouble using the OR operator within a 'while' loop...
- From: matlab_rookie
- Re: Trouble using the OR operator within a 'while' loop...
- From: ImageAnalyst
- Re: Trouble using the OR operator within a 'while' loop...
- From: matlab_rookie
- Re: Trouble using the OR operator within a 'while' loop...
- From: ImageAnalyst
- Re: Trouble using the OR operator within a 'while' loop...
- From: matlab_rookie
- Re: Trouble using the OR operator within a 'while' loop...
- From: ImageAnalyst
- Re: Trouble using the OR operator within a 'while' loop...
- From: matlab_rookie
- Re: Trouble using the OR operator within a 'while' loop...
- From: Randy Poe
- Trouble using the OR operator within a 'while' loop...
- Prev by Date: Re: Create a 10x10 Matrix with numbers appearing only once
- Next by Date: Re: GPS clock into MATLAB
- Previous by thread: Re: Trouble using the OR operator within a 'while' loop...
- Next by thread: Re: Trouble using the OR operator within a 'while' loop...
- Index(es):
Relevant Pages
|