Calling a pushbutton inside a GUI
    2 views (last 30 days)
  
       Show older comments
    
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 Comments
Accepted Answer
  Walter Roberson
      
      
 on 13 Sep 2011
        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 Comments
More Answers (0)
See Also
Categories
				Find more on Interactive Control and Callbacks in Help Center and File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
