필터 지우기
필터 지우기

How to pass value of a variable from one push button to another in matlab guide

조회 수: 6 (최근 30일)
How to pass value of a variable from one pushbutton to another pushbutton in matlab guide?

채택된 답변

Geoff Hayes
Geoff Hayes 2015년 10월 28일
Pavikirthi - in the callback for your first pushbutton, update the handles structure with the value of the variable that you wish to save. i.e.
handles.myVar = someValue;
Now save the updated handles structure using guidata as
guidata(hObject, handles);
(The above assumes that both hObject and handles are inputs to your callback.)
Now, in the other pushbutton callback, you can reference myVar directly using the input handles object as
if isfield(handles,'myVar')
% do something with this variable
end
The above check makes sure that myVar is a field in handles before you try to access it.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by