GUI for existing function in matlab
Show older comments
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 Comments
loma elmossallamy
on 25 Apr 2018
Dennis
on 25 Apr 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
Answers (0)
Categories
Find more on Transfer Function Models 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!