Save
2 ビュー (過去 30 日間)
古いコメントを表示
How can I save variables that is used inside a function? Can I somehow use SAVE command that save the local variables of a function without specifying their name? Something like SAVE ALL.
0 件のコメント
回答 (1 件)
Paulo Silva
2011 年 6 月 9 日
To save all the variables that are inside the function to the file MyFunVariables.mat in the current directory do this
save('MyFunVariables.mat')
or this
save 'MyFunVariables.mat'
The code must be inside the function!
1 件のコメント
Matt Fig
2011 年 6 月 9 日
Not only must the code Paulo gives be in the function, but it should appear in a location within the function where the variables of interest are defined. For example, as the last line in the main function (before the subfunctions, if any).
If, for example, the code was placed as the first line of the function, the only things saved would be the input arguments.
参考
カテゴリ
Help Center および File Exchange で Workspace Variables and MAT-Files についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!