Results 1 to 3 of 3

Math Help - Question in matlab

  1. #1
    Member
    Joined
    Sep 2009
    Posts
    164

    Question in matlab

    Hi All,
    I want to ask about stopping for loop inter if loop, i.e if we have the following:
    for i=1:100
    if ......then ......
    else
    end for
    end if

    Moreover I want to ask if there is a statement in matlab leads to other steps as the following
    if A>B
    go to step 1
    else
    A
    end


    Best wishes
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Grand Panjandrum
    Joined
    Nov 2005
    From
    someplace
    Posts
    14,972
    Thanks
    4
    Quote Originally Posted by raed View Post
    Hi All,
    I want to ask about stopping for loop inter if loop, i.e if we have the following:
    for i=1:100
    if ......then ......
    else
    end for
    end if

    Moreover I want to ask if there is a statement in matlab leads to other steps as the following
    if A>B
    go to step 1
    else
    A
    end


    Best wishes
    >>help break

    CB
    Follow Math Help Forum on Facebook and Google+

  3. #3
    A Plied Mathematician
    Joined
    Jun 2010
    From
    CT, USA
    Posts
    6,318
    Thanks
    5
    Awards
    2
    Did you mean

    for i=1:100
    if ......then ......
    else
    end if
    end for

    ?

    You shouldn't need a goto statement. You can put entire functions and routines in the "if" part, without needing the goto. Goto's are generally considered unstructured.
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Question in matlab
    Posted in the Math Software Forum
    Replies: 5
    Last Post: January 8th 2011, 05:07 AM
  2. matlab question.need help :(
    Posted in the Math Software Forum
    Replies: 0
    Last Post: October 7th 2009, 07:58 AM
  3. Matlab Question Help
    Posted in the Math Software Forum
    Replies: 6
    Last Post: September 20th 2009, 10:57 PM
  4. A Matlab Question
    Posted in the Math Software Forum
    Replies: 2
    Last Post: August 8th 2009, 01:02 AM
  5. Hello - Matlab question
    Posted in the Math Software Forum
    Replies: 1
    Last Post: May 3rd 2009, 11:59 PM

Search Tags


/mathhelpforum @mathhelpforum