フィルターのクリア

MATLAB not saving variables to workspace

35 ビュー (過去 30 日間)
Elvin
Elvin 2014 年 1 月 7 日
コメント済み: To Minh Tan Le 2017 年 1 月 20 日
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!

採用された回答

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 Center および File ExchangeWhos についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by