Save button in GUI Matlab

15 visualizzazioni (ultimi 30 giorni)
Chris Dan
Chris Dan il 22 Lug 2020
Modificato: Cris LaPierre il 22 Lug 2020
Hello,
I am developing a GUI and to save the files, I am currently using this commad
save('SystemMatrices.mat','Mass_Global', 'Damp_Global', 'Stiffness_Global','GlobalMesh')
% this is my save button
function SaveGlobal_Callback(source,eventdata)
[file,path,indx] = uiputfile();
end
I created a save button, but what should i write in it so that the user can choose the location and the name for the file to save. Basically it should be similar, but the user can choose the saving directory, and save 'Mass_Global', 'Damp_Global', 'Stiffness_Global','GlobalMesh in one file
I read this documentation:
but I dont know how it can be applied here
Does anybody know ?

Risposta accettata

Cris LaPierre
Cris LaPierre il 22 Lug 2020
Modificato: Cris LaPierre il 22 Lug 2020
Here, your code could be something like this. Keep in mind variable scope in functions. If the specified variables do not exist in your callback function, you'll need to pass them in or create them inside the function. Since I don't know how they are created, i've left that open ended here.
% this is my save button
function SaveGlobal_Callback(source,eventdata)
Mass_Global = ...;
Damp_Global = ...;
Stiffness_Global = ...;
GlobalMesh = ...;
[file,path] = uiputfile('*.mat');
save(fullfile(path,file),'Mass_Global', 'Damp_Global', 'Stiffness_Global','GlobalMesh')
end

Più risposte (0)

Categorie

Scopri di più su Migrate GUIDE Apps in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by