Why doesnt the workspace show the variables?
조회 수: 4 (최근 30일)
이전 댓글 표시
I run the programme, it ends without any problem. Also with whos command i can see the variables in command window. But workspace doesnt show anything, Also after finishing the run process, i write the variable to the command window but it says undefined variable. Do you know what is the problem? I need to see the variables content from workspace.
채택된 답변
Shane
2012년 9월 19일
Function programs often run through dozens, if not hundreds, of variables before reaching a desired output as designated by the writer. Check the text of the code to determine if the variables you are looking for are output variables. Below is an arbitrary example:
[value1 value2] = function(x)
internalVariable = x * cos(x+10);
value1 = sin(internalVariable)
value2 = tan(internalVariable)
In this code, value1 and value2 are output and will be moved to the workspace. The internalVariable will not be placed in the workplace because it is not designed to be part of the function output. If you would like to make sure the variables are being output into the workspace change the function line to look like this:
[value1 value2 internalVariable] = function(x)
Then when you run the function with three output requests, you will obtain the desired variable in the workplace.
The other way to obtain all the internal variables without editing the code is to run the function within the cell mode in the editor using Ctrl+Enter. This will put all of the internal variables into the workspace.
Hope this helped!
댓글 수: 2
sun
2020년 7월 9일
@Shane ,@Hande
I encountered the same problem,
First, the version of Matlab I use is R2017a.
(1) When executing a custom function (no return value), the program can display the variables inside the function in the workspace.
(2) After I reinstalled matlab (R2017a), no variables are displayed when the same function is executed.
How can I solve it?
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Whos에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!