GUI for existing function in matlab

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 件のコメント

Dennis
Dennis 2018 年 4 月 25 日
編集済み: Dennis 2018 年 4 月 25 日
Do you want to open a GUI with your function or do you want to a GUI that can call your function?
And what is that GUI supposed to do?
loma elmossallamy
loma elmossallamy 2018 年 4 月 25 日
the function should take inputs which will be used in the code so the inputs should be entering in an interface
Dennis
Dennis 2018 年 4 月 25 日
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

サインインしてコメントする。

回答 (0 件)

カテゴリ

質問済み:

2018 年 4 月 25 日

コメント済み:

2018 年 4 月 25 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by