File Exchange

image thumbnail

PARFOR Progress Monitor

version (7.94 KB) by

A Java progress monitor to track progress through a PARFOR loop running MATLAB® workers

9 Ratings



View License

A simple Java progress monitor to show a progress bar on the MATLAB client while Parallel Computing Toolbox workers are executing the iterations of a PARFOR loop. This employs a socket connection from the workers back to the MATLAB client to inform the client when an iteration has been executed.
The MATLAB code must be on the MATLAB path of both the client and the workers; additionally, the java classes must be added to the java class path using javaaddpath.

Comments and Ratings (16)


Darryn (view profile)

Arthur Dgn

Peter Li

Peter Li (view profile)

@Alexandra, when `javaaddpath` is called it calls `clear java`, which also appears to clear globals. Try putting the java path into your setup on startup so you don't have to worry about it later?

Peter Li

Peter Li (view profile)


I had a little trouble on Linux because my pctconfig hostname was just the machine name and I didn't have anything in /etc/hosts for that. It might be helpful to make the socket connection timeout faster so that in situations like this the thing doesn't just appear to freeze?

It also seems to me that the ProgWorker class isn't strictly necessary. It is sufficient to make the Matlab increment(o) method do something like: s =, o.Port); s.close(); (assuming you also change the private constructor to save the HostName and Port instead of creating a ProgWorker. This seems a bit nicer to me as you don't have to worry about the javaclasspath of the Workers.

Peter Li

Peter Li (view profile)


Marius (view profile)

Great tool! Stephen's tip for OSX saved my day.


Eduard (view profile)


To get this to work on osx, you need to modify the matlab class to append '.local' to the hostname.

o.HostName = [cfg.hostname '.local'];


This is a great tool, but it seems to delete all my global variables which is a bit annoying.
Also, I am of the same opinion as Boris. It is a bit small and I cannot read the full title. A few size options would be nice.


Luke (view profile)

This is a great little program. However, i also get problems for large loops:

??? No method 'createServer' with matching signature found for class 'ParforProgressMonitor'.

Error in ==> ParforProgMon>ParforProgMon.ParforProgMon at 48
o.JavaBit = ParforProgressMonitor.createServer( s, n );


Boris (view profile)

Thank you, very usefull!
I have a question though: is it possible to edit the progress bar in some way? In my case even the example won't fully display the word "example' in the upper bar.
It would be nice if the bar could adapt to what it should display or if the user could enter a length (character units?).

Best regards,


Stefan (view profile)

Thank you for your help, now it works.
However, for large values of N (~50000) my Matlab crashes No buffer space available (maximum connections reached?): connect
at Method)
at Source)
at Source)
at Source)
at Source)
at Source)
at Source)
at<init>(Unknown Source)
at<init>(Unknown Source)
at ParforProgressMonitor$ProgWorker.increment(

Best wishes,


Stefan (view profile)

Edric Ellis

Edric Ellis (view profile)

Hi Stefan,
Are you sure you've got the java code on the java path of the workers? I do something like this:
matlabpool local 3
addpath /path/to/stuff
pctRunOnAll javaaddpath /path/to/stuff



Stefan (view profile)

Nice idea, however it does not work for me. It works fine without matlabpool. With matlabpool it gives the following error within the parfor loop:

??? Error using ==> parallel_function at 594
Error in ==>
ParforProgMon>ParforProgMon.increment at 66
Attempt to reference field of non-structure

Any ideas?

Kind regards,


Updated license

MATLAB Release
MATLAB 7.8 (R2009a)
Tags Add Tags

Inspired: PARFOR Progress Monitor v2

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Win prizes and improve your MATLAB skills

Play today