How to modify parameters from a GUI

5 visualizzazioni (ultimi 30 giorni)
Maia
Maia il 18 Dic 2017
Commentato: Stephen23 il 18 Dic 2017
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.

Risposte (1)

Image Analyst
Image Analyst il 18 Dic 2017
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.

Categorie

Scopri di più su Data Import and Export 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