I am trying to make a GUI that allows a user to push a button which smooths the vector N and plots the result on the axes as a function of time. The two vectors are already in my workspace, however Matlab can't see them. Here is the error message I get:
Undefined function or variable "N".Error in gui_test2/smooth1_callback (line 12) N(:,2) = smooth(N(:,2));Error while evaluating UIControl Callback
And here is my code:
function gui_test2f = figure('Visible','off','Position',[400,400,700,500]);smooth1 = uicontrol('Style','pushbutton',... 'String','Smooth',... 'Position',[10,160,200,50],... 'Callback',{@smooth1_callback}); ha = axes('Units','pixels','Position',[250,50,400,400]);f.Visible = 'on';function smooth1_callback(source,eventdata) N(:,2) = smooth(N(:,2)); plot(time,N(:,2)) endend
Best Answer