MATLAB: How to pass value of a variable from one push button to another in matlab guide pushbutton in matlab guide How to pass value of a variable from one pushbutton to another pushbutton in matlab guide? Best Answer 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 endThe above check makes sure that myVar is a field in handles before you try to access it. Related SolutionsMATLAB: Link between edit text 1 and 2 when puch button has click in the edit1 callback save the variable inputted by the user in a variable:handles.myvar = get(handles.edit1,'string');guidata(hObject, handles);in the pushbutton callback put:set(handles.edit2,'string',handles.myvar) MATLAB: SelectionChangeFcn not receiving handles set(handles.uipanel1,'SelectionChangeFcn',...{@uipanel1_SelectionChangeFcn,handles}); Related QuestionHow to update value of a variable when a button is pushed? What am I doing wrong in this codeHelp with understanding how the handles structure is passed and updated in GUIsHow to reset toggle buttons with a push button
Best Answer