只要批处理文件正在运行,我就想计算我的等待栏。
试验:
[status cmdout] = dos('test.bat &'); %the waitbar didn't know when the batch file ends.
[status cmdout] = dos('test.bat'); %the waitbar starts after the batch file ends
使用1运行批处理文件,2是等待栏的功能。问题是,没有可能在matpool中显示某些内容。
matlabpool(2)
parfor i=1:2
parallel_work(i);
end
matlabpool close
h = waitbar(0,'Initializing waitbar...');
t = timer('TimerFcn', 'stat=false;','StartDelay',180);
start(t)
stat=true;
cnt = 0;
while(status==false)
perc = round(58+(42/180)*5*cnt);
waitbar(perc/100,h,sprintf('%d%% ...',perc));
pause(5)
cnt = cnt + 1;
end