Save

조회 수: 7 (최근 30일)
AP
AP 2011년 6월 9일
댓글: Image Analyst 2025년 5월 17일
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.
  댓글 수: 2
Abdo
Abdo 2025년 5월 17일

How can I save project and and share

Image Analyst
Image Analyst 2025년 5월 17일
@Abdo you can send them your .m file or .mlapp file, and any files that are needed upon runtime, like splash images, Excel workbooks, text data files, mat files or whatever files are needed to run your project. I keep all my projects in individual folders with a descriptive name so I can just give someone my whole project folder, plus another folder called Utilities that has a bunch of functions commonly used by all my various projects.

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

답변 (1개)

Paulo Silva
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
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 CenterFile Exchange에서 Environment and Settings에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by