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!