Save button in GUI Matlab
8 次查看(过去 30 天)
显示 更早的评论
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 ?
0 个评论
采纳的回答
Cris LaPierre
2020-7-22
编辑:Cris LaPierre
2020-7-22
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
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Environment and Settings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!