function in a script...
Show older comments
I am having trouble including a function in my script. It gives:
Undefined function 'PlotNewFig' for input arguments of type
'matlab.graphics.axis.Axes'.
Error while evaluating Axes ButtonDownFcn
Here's the code:
...code to load "num" removed...
% savitzky-golay
figure
for nn = 2:ncol
nreversal=0;
bin= num(1,nn);
for mm=2:nrow-1 % look for points where load increases going outboard
if num(mm+1,nn)-num(mm,nn) > 0
fprintf('found reversal %f kNm %d deg.\n',num(mm+1,nn),bin);
nreversal=1;
end
end
y = sgolayfilt(num(2:end,nn), 3, 27);
h3(nn-1)=subplot(6,4,nn-1);
if nreversal==0
plot(num(2:end,1),num(2:end,nn),'b.',num(2:end,1),y,'w-')
set(h3(nn-1), 'ButtonDownFcn', {'PlotNewFig', num(2:end,1),num(2:end,nn),'b.',num(2:end,1),y,'w-',strcat('sgolayfilt(3,27) bin:',num2str(round(bin,0)))})
else
dy=y(:)-num(2:end,nn);
py=y(:)./num(2:end,nn)-1;
y(:)=y(:)+(-50-min(dy));
% check 5% rule too!
plot(num(2:end,1),num(2:end,nn),'b.',num(2:end,1),y,'r-')
set(h3(nn-1), 'ButtonDownFcn', {'PlotNewFig', num(2:end,1),num(2:end,nn),'b.',num(2:end,1),y,'r-',strcat('sgolayfilt(3,27) bin:',num2str(round(bin,0)))})
end
title(bin)
end
ha = axes('Position',[0 0 1 1],'Xlim',[0 1],'Ylim',[0 1],'Box','off','Visible','off','Units','normalized', 'clipping' , 'off');
text(0.5, 0.98,'sgolayfilt(3,27)');
function m = PlotNewFig(varargin)
figure('Name',varargin{9});
plot(varargin{3}, varargin{4} ,varargin{5}, varargin{6},varargin{7}, varargin{8})
end
Maybe I need to declare something?
Accepted Answer
More Answers (0)
Categories
Find more on Entering Commands 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!