Save button in GUI Matlab

15 visualizaciones (últimos 30 días)
Chris Dan
Chris Dan el 22 de Jul. de 2020
Editada: Cris LaPierre el 22 de Jul. de 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 ?

Respuesta aceptada

Cris LaPierre
Cris LaPierre el 22 de Jul. de 2020
Editada: Cris LaPierre el 22 de Jul. de 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

Más respuestas (0)

Categorías

Más información sobre Migrate GUIDE Apps en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by