How to make my code read the input values in appdesigner?
Show older comments
Hi all
I am making an application that should get some input values from UI. But then should run some mfiles that need to know those values. What should I do ? make those variables global ? how ?
9 Comments
Mehmet Ziya KESKIN
on 18 Mar 2020
Call the function(mfiles) from the callback of the UI element. Something like;
funToCall(uin1,uin2)
There is a lot of ways to do it I suggest you search for it!
farzad
on 18 Mar 2020
Mehmet Ziya KESKIN
on 18 Mar 2020
If the your script is non-related to your app, I dont think global would work. Instead use
getappdata/setappdata
or
assignin
to base. Using a function is always better I think, and would solve your problems easily.
farzad
on 18 Mar 2020
Mehmet Ziya KESKIN
on 18 Mar 2020
Global would work. Define global in opening function, define it in pushbutton callbacks, as well. Then set the values.
See this;
Mehmet Ziya KESKIN
on 18 Mar 2020
Try starting with the basics, may be a tutorial. There exist syntax error in your code like
% app.ChooseDirectory.value
app.ChooseDirectory.Value
You can't set a directory(string) to a value etc. Try sth like this, I havent tested;
function ChooseDirectoryButtonPushed(app, event)
global currentFolder;
currentFolder = uigetdir;
function StartButtonPushed(app, event)
global currentFolder;
assignin('base','currentFolder',currentFolder);
goFolder = strcat(currentFolder,'\filename.m');
run(goFolder);
I am not really familiar with app designer, you may find more resources if you work with GUIDE.
farzad
on 18 Mar 2020
farzad
on 18 Mar 2020
Answers (0)
Categories
Find more on Develop Apps Using App Designer 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!