GUI for existing function in matlab
Mostrar comentarios más antiguos
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 comentarios
loma elmossallamy
el 25 de Abr. de 2018
Dennis
el 25 de Abr. de 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
Respuestas (0)
Categorías
Más información sobre Transfer Function Models 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!