Workspace Updates when script is complete?

Does the Workspace only update when the script is completed running? I have this very simply program to test. If I manually clear the workspace at the command line and then run this script, the workspace doesn't list the variables x and y until the entire script is complete.
x = 3
pause(2)
y = 4
pause(2)
Similarly, if I manually (via command line) populate some variables in the workspace and then run the following, again the workspace isn't cleared until script is complete.
clear
pause(2)
The pauses are used to visually confirm when the workspace is updated, which in both cases is when the command prompt returns. I am using the most recent trial version.

 채택된 답변

Walter Roberson
Walter Roberson 2022년 1월 15일

0 개 추천

Correct.
Generally speaking, there would be too much overhead to continually update the workspace browser when you are not stopped.

댓글 수: 4

MB
MB 2022년 1월 16일
Thank you for the response. This behavior does seem counter intuitive - as least for a Matlab newbie like me. My question was driven by need to monitor variables to troubleshoot during code development. Any tips appreciated...
Use breakpoints, or output the data to a uitable (and call drawnow())
Steven Lord
Steven Lord 2022년 1월 16일
You could use the debugging tools included in MATLAB to monitor the progress of your code and pause execution to examine the values of variables during troubleshooting.
MB
MB 2022년 1월 16일
Good suggestions I'll research them from here. Thanks.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Entering Commands에 대해 자세히 알아보기

태그

질문:

MB
2022년 1월 15일

댓글:

MB
2022년 1월 16일

Community Treasure Hunt

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

Start Hunting!

Translated by