How do I save specific workspace variables with UIPUTFILE in MATLAB?

2 vues (au cours des 30 derniers jours)
I want to save workspace variables using the UIPUTFILE to return the path and file name for the MAT-file.

Réponse acceptée

MathWorks Support Team
MathWorks Support Team le 27 Juin 2009
One way to save specific variables using the UIPUTFILE function is to return the file and path names as variables and use them to construct the MAT-file name.
[filename, pathname] = uiputfile('*.mat','Save Workspace Variables As');
newfilename = fullfile(pathname, filename);
save(newfilename, <variables>)
Alternatively, you can use the UISAVE function with the names of the variables in a cell array of strings as the first argument. As an example for the variables “a” and “b”, use the following:
uisave({'a','b'},'myfilename')

Plus de réponses (0)

Catégories

En savoir plus sur Workspace Variables and MAT Files dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by