passing parameter values beween a GUI and other scripts
2 views (last 30 days)
Show older comments
I'm trying to built a GUI (desigend in appdesigner matlab 2020a) to collectuser input data from a scritp to execute calculations, however it is unclear how to get the user input into the workspace. I did declare the variables to have Access = public:
properties (Access = public)
Roi_cam1;
Roi_cam2;
Roi_cam3;
XY_cam1;
XY_cam2;
XY_cam3;
Cal_cam1; % Description
Cal_cam2;
Cal_cam3;
videoName_cam1;
videoName_cam2;
videoName_cam3;
shape;
disch;
Circ;
Exp_name;
Directory;
end
The matlab documentation is not exactly very clear on the topic of getting data in and out of a GUI. Any help is welcome
kind regards
Francois Clemens
0 Comments
Answers (1)
Sreeram
on 28 Oct 2024
Hi Francois,
I understand that you are trying to get certain variables from MATLAB App Designer to the base workspace.
1. Since there are multiple variables to be exported, you can save the variables in a MAT file and then load it into the base workspace:
% In MATLAB App Designer
save("userInputData.mat"," Roi_cam1"," Roi_cam2"," Roi_cam3")
% In the script
load("userInputData.mat")
Here is the relevant section of the “save” function documentation:
2. Another way is to use the “assignin” function to save a variable to the 'base' workspace:
assignin('base', 'Roi_cam1', Roi_cam1)
More details are available on the documentation page for “assignin”:
You may refer to the following relevant MATLAB Answers thread too:
I hope this helps!
0 Comments
See Also
Categories
Find more on Performance and Memory in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!