Calling a pushbutton inside a GUI
조회 수: 10 (최근 30일)
이전 댓글 표시
I have a fairly large program I have been working on for my masters project.
There is a pushbutton called braking that does some calculations and at the end I have this below to store the calculated values into two handles.
handles.break_dis=gdist;
handles.break_vel=gvel;
guidata(hObject,handles)
Then in a separate pushbutton called start I have
braking_Callback(hObject, [], handles);
values=handles.break_dis
If I click on the braking button then the start button it works.
If i click directly on the start button it runs the code in the braking button but when it gets to the values=handles.break_dis line it says "Reference to non-existent field 'break_dis'"
I'm not sure what is happening.
댓글 수: 0
채택된 답변
Walter Roberson
2011년 9월 13일
After your line
braking_Callback(hObject, [], handles);
you need to add
handles = guidata(hObject);
You got a local copy of the handles structure, so when the handles structure was updated elsewhere in the program, your local copy was not updated. You need to fetch the updated version.
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!