GUI for existing function in matlab
Afficher commentaires plus anciens
I have an existing function (ex) that will take inputs to continue the code I wrote now I want to create a GUI for this function how can I call a GUI for this function???
3 commentaires
loma elmossallamy
le 25 Avr 2018
Dennis
le 25 Avr 2018
Without knowing what kind of input you need/ how many parameters you have or what your function looks like i can only provide an easy example. I was guessing that your inputs are numbers, my example wont work with anything else.
function simpleUI ()
fig=figure;
mydata.uihandles(1)=uicontrol('Style','edit','String','Para 1','Position',[20 100 100 40]);
mydata.uihandles(2)=uicontrol('Style','edit','String','Para 1','Position',[20 200 100 40]);
mydata.uihandles(3)=uicontrol('Style','pushbutton','String', 'Click me','Callback',@simpleUI_callback,'Position',[20 300 100 40]);
guidata(fig,mydata)
end
function simpleUI_callback (hObj,~ )
mydata=guidata(hObj);
uihandles=mydata.uihandles;
parameter(1)=str2double(get(uihandles(1),'String'));
parameter(2)=str2double(get(uihandles(2),'String'));
%do stuff
end
Réponses (0)
Catégories
En savoir plus sur Transfer Function Models dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!