필터 지우기
필터 지우기

Why does the workspace of MATLAB not display any variables while running code, but it does display variables during debugging

조회 수: 5 (최근 30일)
Why does the workspace of MATLAB not display any variables while running code, but it does display variables during debugging

답변 (2개)

Walter Roberson
Walter Roberson 2023년 6월 20일
The variable browser is only updated when matlab returns to the command line. Otherwise the cost of updating the browser could be very high.

Harshavardhan Putta
Harshavardhan Putta 2023년 6월 21일
Hi,
I understand that you have noticed a difference in the behavior of the workspace when running code versus debugging.
In MATLAB, variable may not appear in the workspace during code execution but can be visible during debugging due to various factors:
  • Execution flow: When code runs without debugging, MATLAB executes it sequentially, potentially resulting in quick completion or variable clearance, leading to no variable display.
  • Scoping: MATLAB has different scoping rules for variables. Variables defined within functions have local scope. Variables defined in the command window or scripts have global scope.
  • Breakpoints: Debugging with breakpoints enables pausing code execution at specific lines, facilitating variable inspection.
Please refer to the following documentation for more information.
I hope it helps!
Thanks.

카테고리

Help CenterFile Exchange에서 Workspace Variables and MAT-Files에 대해 자세히 알아보기

태그

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by