How to modify parameters from a GUI

6 次查看(过去 30 天)
Maia
Maia 2017-12-18
评论: Stephen23 2017-12-18
Hi, I have an application with many parameters to set. I managed to modify those parameters with a .m file with struct, e.g. (I have more than 20 parameters to set):
function [params_01,params_02] = define_params()
% first params struct
params_01.value1 = 1;
params_01.value2 = 2;
params_01.value3 = 3;
params_01.value4 = 4;
% second params struct
params_02.value1 = 1;
params_02.value2 = 2;
params_02.value3 = 3;
params_02.value4 = 4;
end
I'd like to be able to load / modify /change /save those parameters within a standalone compiled GUI. I read so far to use *.text file, but it's unclear for me how to use that, I found a video back in 2014, I couldn't find the codes within the video. (https://blogs.mathworks.com/videos/2014/09/29/reading-parameters-from-a-file-in-matlab/)
Thank you for your help.

回答(1 个)

Image Analyst
Image Analyst 2017-12-18
Simply call
[params_01, params_02] = define_params()
in your GUI code somewhere. If you want those variables to be available in a function other than the one you call define_params() from, then see this link for info on how to expose the variables to other functions.

类别

Help CenterFile Exchange 中查找有关 Data Import and Export 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by