Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Stopping an if statement

Subject: Stopping an if statement

From: Halley

Date: 10 Jan, 2013 11:11:08

Message: 1 of 3

I have a series of functions I want to complete if a certain statement is true, In this case it is

if p(i,j,k) <= -1
 How do I stop the loop after this has been proven true only once? I only care about the first occurence of this being true in my matrix, only at that point do I want to run my other functions. Thank you.

Subject: Stopping an if statement

From: Jos (10584)

Date: 10 Jan, 2013 12:58:07

Message: 2 of 3

"Halley" wrote in message <kcm7kc$lni$1@newscl01ah.mathworks.com>...
> I have a series of functions I want to complete if a certain statement is true, In this case it is
>
> if p(i,j,k) <= -1
> How do I stop the loop after this has been proven true only once? I only care about the first occurence of this being true in my matrix, only at that point do I want to run my other functions. Thank you.

help break

~ Jos

Subject: Stopping an if statement

From: anyone

Date: 17 Jan, 2013 18:20:26

Message: 3 of 3

On Thu, 10 Jan 2013 11:11:08 +0000, Halley wrote:

> I have a series of functions I want to complete if a certain statement
> is true, In this case it is
>
> if p(i,j,k) <= -1
> How do I stop the loop after this has been proven true only once? I
> only care about the first occurence of this being true in my matrix,
> only at that point do I want to run my other functions. Thank you.

Don't use 'if". See 'For/While loop"

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us