How can i remove matlabpool('open',2) with parpool?
Show older comments
Hello everybody,
I have MATLAB R2015b and I try to replicate a given code, but it does not work since the command matlabpool has been removed and I am not familiar with the suggest parpool command. How can I rewrite the code so that it will work? Thank you all for your help!
This is my code:
format short
matlabpool('open',2);
qe=[0.90;0.95;0.99];
tic;
m=2000;
T=200;
swindow0=40;
r0=swindow0/T;
dim=T-swindow0+1;
y=DGP(T,m);
gsadf=ones(m,1);
parfor j=1:m;
sadfs=zeros(dim,1);
for r2=swindow0:1:T;
dim0=r2-swindow0+1;
rwadft=zeros(dim0,1);
for r1=1:1:dim0;
rwadft(r1)= ADF_FL(y(r1:r2,j),0,1); % two tail 5% significant level
end;
sadfs(r2-swindow0+1)=max(rwadft);
end;
gsadf(j)=max(sadfs);
end;
toc;
matlabpool('close');
quantile_gsadf=quantile(gsadf,qe);
filename = 'CV_GSADF_200_02.xlsx';
xlswrite(filename,gsadf,1,'A1:A2000');
disp([qe quantile_gsadf]);
Answers (2)
Walter Roberson
on 25 Apr 2016
p = parpool('local', 2);
and then later
delete(p);
eugenio bedeschi
on 15 Apr 2018
0 votes
Hello, I'm a beginner, experiencing the same problem: I replaced """matlabpool('open',2); and matlabpool('close');""" with """p = parpool('local', 2); and delete(p);""" but now the code stops at y=DGP(T,m); : mathlab tells me it's undefined, I've searched the internet, but no answer. Can you help me?
Thank you
Categories
Find more on Parallel Computing Fundamentals 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!