![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1751299/image.png)
MATLAB not saving variables to workspace
48 次查看(过去 30 天)
显示 更早的评论
I don't know what's wrong with my MATLAB. Every time I run the dummy.m using the F5 in the editor, all the variables are being displayed in the workspace. But when I run the NitrogenDef.m using again the F5 in the editor, all the variables used in the NitrogenDef.m are not displayed in the workspace. Any help with this? Thanks!
1 个评论
abdelkader omr
2024-8-12
移动:Walter Roberson
2024-8-12
I saved figure as follow,but I can't find it in my workspace
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1751299/image.png)
采纳的回答
Ryan Johnson
2014-1-7
That's because NitrogenDef is a function, so any variables created within it are only scoped for the life of the function (unless made global).
Comment out the first line function NitrogenDef() and it will run as a script.
更多回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Search Path 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!