The following code takes no more than 4 seconds to execute:
figure(statfig);set(gcf,'Position',get(0,'ScreenSize').*[1 1 0.5 1]);titlestr = [test ' - Statistics - ' num2str(rpmval) 'RPM - ' samplestr ' - ' upper(sensor)];subplot(size(detdata,2),1,var);plot(detdata(:,var)');hold on;% line([1:length(detdata)],avg_env_sample(var),'Color','r');
% line([1:length(detdata)],avg_env(var),'Color','g');
hold off;% legend('Detrended Data','Envelope','Envelope Mean');
title([titlestr ' - ' varname]);xlabel('Sample [n]');ylabel([varname ' [g]']);set(gcf,'Name',titlestr);
With the commented code uncommented, execution time goes up to two minutes. Similar code is executed 3 other times (without the line commands) without a problem.
Any suggestions?
Best Answer