Call a function with inputs with a GUI.

I am using GUIDE to create a GUI and am having difficulties trying to call a function that has input variables with a push button.
code:
function Load_Callback(hObject, eventdata, handles)
% hObject handle to Load (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
x1 = handles.X1;
x2 = handles.X2;
y1 = handles.Y1;
y2 = handles.Y2;
run manirectangle ;
manirectanlgle is a function that has inputs x1, x2, y1, y2. I am trying to pass these variables into the function itself. Is it possible to do so? Thanks in advance.

 採用された回答

Geoff Hayes
Geoff Hayes 2016 年 6 月 23 日

0 投票

Sergio - if the manirectangle requires the four inputs of x1, y1, x2, and y2 then just call it by passing in these parameters (in the correct order of course)
function Load_Callback(hObject, eventdata, handles)
x1 = handles.X1;
x2 = handles.X2;
y1 = handles.Y1;
y2 = handles.Y2;
manirectangle(x1,x2,y1,y2);
Note how I have omitted the run as it isn't necessary.

1 件のコメント

Sergio  Castillo
Sergio Castillo 2016 年 6 月 23 日
It worked; Thank you very much!

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeInteractive Control and Callbacks についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by