Very useful indeed!
I am not sure if I am missing something, but unfortunately I am not able to make it finding multiple files with same name (even if in different folders). This would be a great improvement!
I had try the example and its works. However i was facing a problem when applied it in my own program which it come out ''??? Index exceeds matrix dimensions.'' It happen when i use goto(137) in line 335. But it works when i use goto(314) in line 294(another part in same program). Will this mean the goto function not suitable to use for big gap?
Diego, thank you for the feedback, but why didn't you rate the file accordingly? :-)
You're right about multiple line inputs, I already did it for the more important ones (FOR, WHILE, IF, BREAK, etc...) but from a programming point of view, doing it for multiple lines distinguished by "..." is pretty simple. I guess this is a reason for an update soon.
Glad the file helped, come again!
How, very good!
I need something exactly like this. In my case, a FOR loop will make my script graceless because the use of cell and text markup in the code.
With your GOTO function, I construct a for loop without identation or a new text markup.
A contribution that I can do to your work is an error that ocurred when my code has construction in more than one line like the following examples:
A = [1, 2, 3, ...
4, 5, 6];
B = [1 2 3
4 5 6];
In these cases, Matlab return that the line is an invalid statement. I guess it do so because your function not treat these statements. You code already do it in FOR, WHILE, IF, etc, statements, only left these others.
Forgime my bad english, I'm from Brazil and not speak english.
Thank you again!
Diego da Silva de Medeiros
That's how a proper goto() would work.
If you want the loop to continue iterating, simple use goto() without following it with a return().
E-mail me next time if you have problems before you rate the file.