PDA

View Full Version : Matlab 'goto' statements


dks2114
Oct 12, 2007, 04:20 PM
Okay, so I have previous knowledge of Visual basic and Q-basic and well in these programs if I wanted to go to a certain line I would write 'goto 1' or 'goto line 1' etc. Does anyone know the notation for such a move in Matlab (if this is a legal move in Matlab)?

anandji
Feb 20, 2008, 09:15 PM
Okay, so I have previous knowledge of Visual basic and Q-basic and well in these programs if I wanted to go to a certain line i would write 'goto 1' or 'goto line 1' etc. Does anyone know the notation for such a move in Matlab (if this is a legal move in Matlab)?
Bhvghcv

anandji
Feb 20, 2008, 09:15 PM
Fhfghgfhgfhj sdfgdfh d

fwety
Feb 20, 2011, 11:55 PM
MATLAB does not support the use of go to statements on the rationale that it promotes poor programming practice. I suggest writing your code to work with for,while,if-elseif, or switch/case.
If you're dead set on using go to statements, then you could write your code in FORTRAN (use global variables for scope purposes), and then 'mex' it into MATLAB (using the mex command).