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