How to make my code read the input values in appdesigner?
Mostrar comentarios más antiguos
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 comentarios
Mehmet Ziya KESKIN
el 18 de Mzo. de 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
el 18 de Mzo. de 2020
Mehmet Ziya KESKIN
el 18 de Mzo. de 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
el 18 de Mzo. de 2020
Mehmet Ziya KESKIN
el 18 de Mzo. de 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
el 18 de Mzo. de 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
el 18 de Mzo. de 2020
farzad
el 18 de Mzo. de 2020
Respuestas (0)
Categorías
Más información sobre Develop Apps Using App Designer en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!