Really simple question. I wish to create GUI
with a simple plot
that changes something with a slider. I have been using the GUI and have a slider+text on a panel and axies1. So for starters I just wish to have the slider going from 1:10 (no specific increments) and scaling the y-values (by 1:10). I have imported my data into the GUI, so leaving out the generic auto-generate code I have:
Under Graphslide_OpeningFcn
handles.OutAirTemp = OutAirTemp;
handles.SupAirTemp = SupAirTemp;
guidata(hObject,handles);
handles.a = get(handles.slider2,'Value');
plot(handles.SupAirTemp,handles.a*handles.OutAirTemp)
Under slider2_Callback
a = get(hObject,'Value')
So clearly I am missing something! Any pointers, theory or code will be greatly received.
Edit1
There was no error message for the above. It however didn't change the graph when sliding the slider.
Best Solution
You don't say what error message you get or what the problem is, so we can't guess what's wrong. However, there are a few things I can see are wrong:
plot
commandfor your
slider2_Callback
, you probably needhandles.a = get(hObject,'Value') guidata(hObject,handles);
for your
Graphslide_OpeningFcn
, you don't say whereOutAirTemp
andSupAirTemp
come from. I would also issue theguidata
at the end of the function rather than in the middle as your are doing.