workspace variable

1 回表示 (過去 30 日間)
Baba
Baba 2011 年 11 月 15 日
My program stores data in a workspace variable. The variable is visible only when the program is done running. I was wondering if it's possible to see that workspace variable in the workspace window as the pgrogram is running and see it's content grow.

採用された回答

Doug Hull
Doug Hull 2011 年 11 月 15 日
You could put a pause statement or debug. MATLAB is not going to take the time to update the WS viewer. How long does your code take to run?
  3 件のコメント
Baba
Baba 2011 年 11 月 15 日
so can i just pause the execution at any time? and then restart to continue?
Walter Roberson
Walter Roberson 2011 年 11 月 15 日
A pause() statement with no argument will wait for keyboard input before resuming.
You can also use keyboard():
KEYBOARD, when placed in an M-file, stops execution of the file
and gives control to the user's keyboard. The special status is
indicated by a K appearing before the prompt. Variables may be
examined or changed - all MATLAB commands are valid. The keyboard
mode is terminated by executing the command RETURN (i.e. typing
the six letters R-E-T-U-R-N and pressing the return key). Control
returns to the invoking M-file.

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

その他の回答 (1 件)

Image Analyst
Image Analyst 2011 年 11 月 15 日
If your program takes 10 minutes to run, that variable probably gets changed a bazillion times. Maybe you can plot it. You can use a line plot if you keep track of every value that variable takes on, or maybe just use a bar chart or text label if you just want to show the latest value. Make sure you issue the "drawnow" command right after you update your plot or text with the new value(s).

カテゴリ

Help Center および File ExchangeEnvironment and Settings についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by