A little thing to ask in matlab!

tshuck

Joined Oct 18, 2012
3,534
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.
 

tshuck

Joined Oct 18, 2012
3,534
No , Actually , what i want to know, is to obtain a matlab file, which contains For abd "end" but well organized !!
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
a matlab file, which contains For abd "end" but well organized
 

Thread Starter

katkoutexpress

Joined Apr 9, 2013
6
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 !!
 

tshuck

Joined Oct 18, 2012
3,534
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 !!
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...
 
Top