Re: Trouble using the OR operator within a 'while' loop...



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
.



Relevant Pages