"parfeval" and "backgroundPool" to create background progress bar
Mostrar comentarios más antiguos
Dear experts, I am trying to cretae a progress bar that runs in background.
My silly progressbar code is:
function [WaitF] = DBWaitGUI2
ScreSize = get(0,'screensize');
ScreSize = ScreSize(3:end);
matBar(:,:,1) = ones(256,256);
matBar(:,:,2) = zeros(256,256);
matBar(:,:,3) = zeros(256,256);
matBarg(:,:,1) = ones(256,256).*0.6;
matBarg(:,:,2) = ones(256,256).*0.6;
matBarg(:,:,3) = ones(256,256).*0.6;
WaitF = figure('Name','','NumberTitle','off','Color',[0.4 0.4 0.4],...
'Position',[ScreSize(1)/2-200 ScreSize(2)/2-50 400 60],...
'MenuBar','none');
% undecorateFig(WaitF)
sub1 = subplot('Position',[0.012 0.1 0.08 0.8],'Units','Normalized');
b1 = imagesc(sub1,matBar);
axis off
box off
AChilds.b1 = b1;
sub2 = subplot('Position',[0.12-0.013 0.1 0.08 0.8],'Units','Normalized');
b2 = imagesc(sub2,matBarg);
axis off
box off
AChilds.b2 = b2;
sub3 = subplot('Position',[0.22-0.013 0.1 0.08 0.8],'Units','Normalized');
b3 = imagesc(sub3,matBarg);
axis off
box off
AChilds.b3 = b3;
sub4 = subplot('Position',[0.32-0.013 0.1 0.08 0.8],'Units','Normalized');
b4 = imagesc(sub4,matBarg);
axis off
box off
AChilds.b4 = b4;
sub5 = subplot('Position',[0.42-0.013 0.1 0.08 0.8],'Units','Normalized');
b5 = imagesc(sub5,matBarg);
axis off
box off
AChilds.b5 = b5;
sub6 = subplot('Position',[0.52-0.013 0.1 0.08 0.8],'Units','Normalized');
b6 = imagesc(sub6,matBarg);
axis off
box off
AChilds.b6 = b6;
sub7 = subplot('Position',[0.62-0.013 0.1 0.08 0.8],'Units','Normalized');
b7 = imagesc(sub7,matBarg);
axis off
box off
AChilds.b7 = b7;
sub8 = subplot('Position',[0.72-0.013 0.1 0.08 0.8],'Units','Normalized');
b8 = imagesc(sub8,matBarg);
axis off
box off
AChilds.b8 = b8;
sub9 = subplot('Position',[0.82-0.013 0.1 0.08 0.8],'Units','Normalized');
b9 = imagesc(sub9,matBarg);
axis off
box off
AChilds.b9 = b9;
sub10 = subplot('Position',[0.92-0.013 0.1 0.08 0.8],'Units','Normalized');
b10 = imagesc(sub10,matBarg);
axis off
box off
AChilds.b10 = b10;
kee=0;
while kee == 0
for iu = 1:10
if iu>1
eval(['AChilds.b',num2str(iu-1),'.CData = matBarg;']);
else
eval(['AChilds.b',num2str(10),'.CData = matBarg;']);
end
eval(['AChilds.b',num2str(iu),'.CData = matBar;']);
pause(0.1);
end
end
end
So I am trying:
parfeval(backgroundPool,DBWaitGUI2);
The progress bar looks fine, but, Matlab is still waiting for the infinite process to end. Any idea of how to solve it? Am I committing any sin?
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Loops and Conditional Statements en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!