take the execution to the specific line in matlab code
6 ビュー (過去 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!