MATLAB not saving variables to workspace

조회 수: 49 (최근 30일)
Elvin
Elvin 2014년 1월 7일
이동: Walter Roberson 2024년 8월 12일
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
abdelkader omr 2024년 8월 12일
이동: Walter Roberson 2024년 8월 12일
I saved figure as follow,but I can't find it in my workspace

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

채택된 답변

Ryan Johnson
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.
  댓글 수: 7
Elvin
Elvin 2014년 1월 7일
It's now okay. I just cut the Blobs function and paste it to a new editor and save it sa Blobs.m. And on the NitrogenDef, I already commented the first line.
Thank you very much for the help :)
To Minh Tan Le
To Minh Tan Le 2017년 1월 20일
Thanks Ryan.

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

추가 답변 (1개)

Azzi Abdelmalek
Azzi Abdelmalek 2014년 1월 7일
They are different type of file : script file and function file

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by