Skip to content

Instantly share code, notes, and snippets.

@sg-s
Last active August 29, 2015 14:05
Show Gist options
  • Save sg-s/d5d5c585b06539337dd2 to your computer and use it in GitHub Desktop.
Save sg-s/d5d5c585b06539337dd2 to your computer and use it in GitHub Desktop.
This contains some workarounds for annoying bugs in MATLAB's publish function

Some workaround to common problems with MATLAB's publish()

Slow scatter

Problem: Horrible slowdowns when using scatter() in a script that you want to publish Solution: Don't use scatter. Use plot(x,y,'.') instead.

Combinatorial Figure mess

Problem: Horrible slowdown when publishing a document that has many figures in it. Symptom: You will see MATLAB cycling through all open figures. This means that it does something like this:

make fig 1
make fig 2
bring fig 1 to front
bring fig 2 to front
make fig 3
bring fig 1 to front...
...and so on.

You can see why this can become a problem.

The solution: Insert the following code after every time you're done with a figure:

snapnow();
delete(gcf);

And this really makes publish much faster

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment