How to modify parameters from a GUI

5 ビュー (過去 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 Center および File ExchangeData Import and Export についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by