Pushbutton callback problem to update the colors in GUI. I want to update the background colors when the button is pushed and save the existing color values.
Show older comments
This is my Opening function.
function untitled1_OpeningFcn(hObject, eventdata, handles, varargin)
% Choose default command line output for untitled1
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
z=rand()
background1=[z z z]
set(handles.axes1,'Color',background1);
i=rand()
background2=[i i i]
set(handles.axes2,'Color',background2);
a=rand()
b=rand()
c=rand()
backgroundStim=[a b c]
set(handles.axes3,'Color',backgroundStim);
set(handles.axes4,'Color',backgroundStim);
This is my pushbutton callback.
function pushbutton1_Callback(hObject, eventdata, handles)
handles=guidata(hObject);
bg1 = get(handles.axes1,'Color')
bg2 = get(handles.axes2,'Color')
bgStim = get(handles.axes3,'Color')
save('Output.mat','bg1','bg2','bgStim')
guidata(hObject, handles)
I want to present the next random colors in the GUI. In order to do that i need to call the opening function again right? I also want to save the existing color values and update the GUI.
Accepted Answer
More Answers (0)
Categories
Find more on Creating, Deleting, and Querying Graphics Objects 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!