|
> N=100;
> BEEN_DONE_VEC=false(N,1)
> wait_handle=waitbar(0);
> parfor (IND=1:N)
> BEEN_DONE_VEC(IND)=true;
> waitbar(wait_handle,mean(BEEN_DONE_VEC))
> ...do something
> end
I had a similar idea. Matlab did not accept it though, since it will regard the mean(...) command (I used sum(...)) as something inconsistent as it varies with the order of the parfor loop execution - of which all results of course should be independent.
I thought of something more basic then:
fprintf(repmat('*',1,N));
parfor ind = 1 : N
fprintf('\b')
...
end
if N is too large fractioning is be necessary. Its crude but it works.
fractioning in parts n, choose n appriopriatly:
M = numel(find(mod(1:N,n)==0));
fprintf(repmat('*',1,M));
parfor ind = 1 : N
if mod(ind,n)==0; fprintf('\b'); end
...
end
|