我在matlab中有以下代码,非常慢。这段代码与我之前在堆栈溢出中的帖子有关我想知道是否有任何方法可以使matlab更快,当我运行代码时它应该显示我的数字,更新图像,但它没有显示任何东西
%% Loading Data
cd('D:\MatlabTest\15-07SpeedSensitivity\0.3');
clear all
row=101;
column=311;
%%
%Coefficients Creation
N=5;
W = [0.005 0.10;0.10 0.20;0.20 0.30;0.30 0.40;0.40 0.50;0.50 0.60 ;0.60 0.70;0.70 0.80 ;0.80 0.90;0.90 1.0];
for ind=1:9
wn = W(ind,:);
[b,a] = butter(N,wn);
bCoeff{ind}=b;
aCoeff{ind}=a;
end
[bCoeff{10},aCoeff{10}]=butter(N,0.9,'high');
%%
%filter initialization
ZState = cell(1,10);
for i=1:10
ZState{i} = zeros(max(length(aCoeff{i}), length(aCoeff{i})) - 1, 1); %# This is the initial filter state
end
%%
bands=10;
for b=1:bands
Yout{b}{row, column}=[];
end
%%
j=1;
K = 1000:4000;
window = zeros(1,10);
figure;
y = 0; %# Preallocate memory for output
j=0;
buffSize=10;
tempMean{row,column}=[];
Gibbs=(length(K)*3)/100;
fImg{1}(row,column)=0;
%load one image
for i = 1000:length(K)
disp(i)
str = int2str(i);
str1 = strcat(str,'.mat');
load(str1);
D(:,:) = A(100:200 ,200:510);
%go throught the columns and rows
for p = 1:row
for q = 1:column
%calculte the temporal mean value based on previous ones
if(size(tempMean{p,q})<buffSize) %init the first 10
tempMean{p,q}=[D(p,q) tempMean{p,q}];
else
tempMean{p,q}=[D(p,q) tempMean{p,q}(1:end-1)];
end
if(mean2(tempMean{p,q})==0)
x=0;
else
x = double(D(p,q)/mean2(tempMean{p,q}));
end
%filtering for 10 bands, based on the previous state
for f = 1:10
[y, ZState{f}] = filter(bCoeff{f},aCoeff{f},x,ZState{f});
if(j<Gibbs)
continue;
end
if(size(Yout{f}{p,q})<10)%init the first 10 after Gibbs phenomenon
Yout{f}{p,q} = [y.^2 Yout{f}{p,q}];
else
Yout{f}{p,q} = [y.^2 Yout{f}{p,q}(1:end-1)];
fImg{f}(p,q)=mean2(Yout{f}{p,q});
end
end
end
end
if(size(fImg{1}(1,1))>1)
for k = 1:10
subplot(5,2,1);
subimage(fImg{k}*5000, [0 0.5]);
colormap jet
end
pause(0.01);
end
j=j+1;
end
disp('Done Loading...')`