I am trying to make a GUI that allows a user to push a button which smooths a column in a vector and plots the result on the axes. However my GUI
Show older comments
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_test2
f = 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))
end
end
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!