How to pass value of a variable from one push button to another in matlab guide
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
pavikirthi
el 28 de Oct. de 2015
Comentada: Muhammad Talha Bashir
el 12 de En. de 2022
How to pass value of a variable from one pushbutton to another pushbutton in matlab guide?
0 comentarios
Respuesta aceptada
Geoff Hayes
el 28 de Oct. de 2015
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;
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.
2 comentarios
Muhammad Talha Bashir
el 12 de En. de 2022
but how can i access more than one variable from other pusbutton?
Más respuestas (0)
Ver también
Categorías
Más información sobre Migrate GUIDE Apps en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!