So i need to do a window with buttons, for example there are 2 buttons, one of them plots one data from 81×1 matrix and another should plot other data from same range but different matrix (81×1) . i used >>guide > Blank GUI (default) for my windows and plot setup.
When i use separate script for plot :
plot(t(:,1),speed(:,1));xlabel('time');ylabel('speed');
works perfectly, but when i try to do it in callback for a button
% --- Executes on button press in Greitis.
function Greitis_Callback(hObject, eventdata, handles)% hObject handle to Greitis (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
axes(handles.axes1);plot(t(:,1),speed(:,1));xlabel('time'); ylabel('speed');
window opens. When i press button to plot my data i get this :
>> untitled1Undefined function or variable 't'.Error in untitled1>Greitis_Callback (line 107)plot(t(:,1),speed(:,1)); Error in gui_mainfcn (line 95) feval(varargin{:});Error in untitled1 (line 42) gui_mainfcn(gui_State, varargin{:});Error in matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)untitled1('Greitis_Callback',hObject,eventdata,guidata(hObject)) Error while evaluating UIControl Callback
im kinda newbie, so need your help there, have a nice day 🙂
Best Answer