take the execution to the specific line in matlab code
3 次查看(过去 30 天)
显示 更早的评论
I have some code in matlab, I want to take the execution from line 200 to line 100
I need something like gotoxy function in C
how can I do it in matlab?
thanks
0 个评论
回答(2 个)
Azzi Abdelmalek
2013-9-8
编辑:Azzi Abdelmalek
2013-9-8
There is no goto instruction in Matlab. But you can avoid using it by using
while loop
if else if
break
continue
You can also call function
0 个评论
Walter Roberson
2013-9-8
gotoxy is not part of the C standard. On systems and displays it is implemented on, it moves the display cursor to the indicated position, but it does not affect what is being executed. In C, the closest method to affect what is being executed is goto (which requires a named label as a target, not a line number.)
MATLAB does not have any mechanisms to continue execution at a specific line number or line label. There is no "goto" in MATLAB; there are only the regular control mechanisms such as "while" and "for" and "break" and "continue"
There might possibly be a mechanism for changing the position of the display cursor relative to the command window, but only for the case that the desktop interface of MATLAB is being used (not the command-line interface.) The mechanism is not a fundamental part of MATLAB, and if it exists it is somewhere down in the desktop object class that I have never explored. If this is what you are wanting to do and you are not trying to program the editor / command window interactions themselves, then you should consider instead presenting the text through a figure and using the supported interfaces for that.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Interactive Control and Callbacks 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!