A little thing to ask in matlab!

Discussion in 'General Electronics Chat' started by katkoutexpress, Apr 27, 2013.

  1. katkoutexpress

    Thread Starter New Member

    Apr 9, 2013
    6
    0
    Hi every body,
    I want to know how can Matlab indicate automatically the beginning of "for" and "end", thank u :))
     
  2. tshuck

    Well-Known Member

    Oct 18, 2012
    3,531
    675
    What exactly are you asking?

    Is it that you are asking how MATLAB understands what "end" goes with what "for"? If that is the case, it just matches the last "end" with the previous loop statement, e.g. "for".

    The use of the keyword "for" tells the program to find a matching "end", anything in between is evaluated on each iteration of the for loop.
     
  3. katkoutexpress

    Thread Starter New Member

    Apr 9, 2013
    6
    0
    No , Actually , what i want to know, is to obtain a matlab file, which contains For abd "end" but well organized !!
     
  4. tshuck

    Well-Known Member

    Oct 18, 2012
    3,531
    675
    I'm now more confused than when I read it initially.:confused:

    You are talking about a script, then? A *.m file?

    You need to be more clear, give us some more information than
     
  5. katkoutexpress

    Thread Starter New Member

    Apr 9, 2013
    6
    0
    yeah i see, u're right!!
    Well, i mean, i want the keywords "for"and "end" well organized when , the first one appears , so that i can write the instructions , after that Matlab puts automatically "end" under "for" in an organized way !!
     
  6. tshuck

    Well-Known Member

    Oct 18, 2012
    3,531
    675
    Okay, so you mean that you'd like to have MATLAB automatically generate a "end" when you type a "for" or similar?

    If that is the case, it can't be done in the MATLAB environment(unless you have access to source code), but if you are writing a *.m file, I'm sure you could use an external program with scripts to do that, but it would be a huge pain, and probably better to simply type e-n-d.

    If you write *.m files, indentation helps understand what end goes with what for...
     
  7. katkoutexpress

    Thread Starter New Member

    Apr 9, 2013
    6
    0
    i think you're right it is better to type END .. Thank u so much good night :)
     
Loading...