LIve editor: invalidate section

1 回表示 (過去 30 日間)
Simon Parten
Simon Parten 2017 年 11 月 10 日
コメント済み: Steven Lord 2017 年 11 月 10 日
Some of my scripts have side effects, whilst I appreciate that this isn't optimal design, the live editor appears to make life difficult, because once one has run a section, it doesn't appear to be easy to 're-run' it. It feels like matlab is trying to be too clever. It thinks the section is run, and so it won't re run it. until after I edit the section. Which is annoying, I just want to re run it.
Is there a way to 'invalidate the result of all sections' in a live script without having to edit each?
  1 件のコメント
Simon Parten
Simon Parten 2017 年 11 月 10 日
Hmmm... okay, I might have the wrong question.
I think this happens if you are debugging 'normal matlab' at the same time. Then Things go weird.

サインインしてコメントする。

回答 (1 件)

Steven Lord
Steven Lord 2017 年 11 月 10 日
There are several ways listed on this documentation page for how to run a section in a live script.
  2 件のコメント
Simon Parten
Simon Parten 2017 年 11 月 10 日
編集済み: Simon Parten 2017 年 11 月 10 日
I understand how to run a section - my problem was that I wanted to 're run' the section. It appeared to me that wasn't happening, that matlab was systematically ignoring my request for sections which had already been run.
I this this occurs if you are debugging a 'normal matlab' script at the same time.
Steven Lord
Steven Lord 2017 年 11 月 10 日
What gave the appearance that the section did not re-run? Were you expecting the variables it generated to appear in the base workspace?
If that was what you expected, when you're debugging you're operating in the workspace of the function you're debugging. That allows you to view and modify the values of the variables in that workspace to try to identify the cause of the problem that led you to debug in the first place.
If you run a script during that time, the variables get created in the function's workspace. It doesn't matter whether the script is somehow "associated" with the function being debugged or a completely separate file in a whole other directory.
Once your debugging ends (either by letting the function run to the end or by dbquit) the function workspace goes away as do the variables you created inside it by running that section of your script.
If there was some other reason that made you believe the section was not re-run, can you explain in a little more detail what that reason was?

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeDebugging and Analysis についてさらに検索

タグ

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by