Skip to content

Instantly share code, notes, and snippets.

@stijnvanhoey
Last active May 15, 2020 07:24
Show Gist options
  • Save stijnvanhoey/0a2519707a2840d89e5bce35c5ecd93d to your computer and use it in GitHub Desktop.
Save stijnvanhoey/0a2519707a2840d89e5bce35c5ecd93d to your computer and use it in GitHub Desktop.
[Matlab tips and tricks] Small utilities and usefulsnippets for Matlab

In the console, do:

dbstop if error

to stop Matlab in debugging mode on an error.

To get a progress bar for parfor parrallel executions:

q = parallel.pool.DataQueue;
afterEach(q, @progress);

parfor ip = 1:N

	...
	
    send(q, ip); 
end

function progress(~)
  status = status + 1;
  if mod(status, 10)==0
    fprintf('status: %d/%d\n', status, N)
  end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment