how i can display the variables in work space?

조회 수: 147 (최근 30일)
Ameligege
Ameligege 2015년 4월 21일
댓글: Ted Shultz 2019년 1월 29일
Hello, When I run any code the variable does not appear in the work space window ,may anyone help me to solve this problem? thanks

채택된 답변

Stephen23
Stephen23 2015년 4월 22일
편집: Stephen23 2015년 4월 22일
MATLAB actually has different workspaces! The main workspace is called the base workspace, but every function also has its own private workspace: this is done on purpose to keep the internal details of how functions work separate from each other and from the base workspace too.
If you want to see the variables in a function workspace, then you have two main ways to achieve this:
  • return some variables (i.e. output arguments) from a function to another workspace.
  • use the debugging tools to view inside any workspace.
This is explained in the documentation too: "By default, the Workspace browser displays the base workspace. You also can view function workspaces if MATLAB is in debug mode. For more information, see Debugging Process and Features..."
It is not recommended to magically pass all variables to another workspace via assignin, evalin or something similar. This is buggy and slow. MATLAB themselves describe the best practices for passing variables around between workspaces.
  댓글 수: 1
Ted Shultz
Ted Shultz 2019년 1월 29일
This is the page is linked from the page Stephen linked to, and may be helpful:

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Whos에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by