Why Does Handles Overwrite This Variable?
Mostrar comentarios más antiguos
I have created a GUI with only two push buttons and then replaced the callback functions of these two push buttons with the code below:
function pushbutton1_Callback(hObject, eventdata, handles)
handles.MyValue1 = 4;
assignin('base', 'handles', handles);
function pushbutton2_Callback(hObject, eventdata, handles)
handles.MyValue2 = 2;
assignin('base', 'handles', handles);
When I run this GUI and press pushbutton1, MyValue1 appears in the struct handles (visible in the Variables Window). When I press pushbutton2, MyValue2 appears and suddenly makes MyValue1 disappear! What is happening to MyValue1? How can I keep both MyValue1 and MyValue2 in the struct? If you know the reason, please explain it elaborately. Thanks!
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Structures en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!