Those of you who don’t know or don’t care what Matlab is… today’s post isn’t for you. Just skip it.

Now that the cool kids have left, us geeks can be alone: So, in my lab at GT we primarily use Matlab, so I’m trying to rekindle that romance after a torrid affair with C++ at Siemens. Unarguably, one of the best things about Matlab is how easy it is to visualize things. However, one little tidbit has always bugged me. There is always that damn big fat gray border around all of your figures. This is only mildly annoying while programming… but when it comes time to save figures out for a paper or a report annoying becomes infuriating. You have to scale and crop and zoom and you can’t script it well at all. (Not being able to script things is one of my pet peeves.)

But fear not dear friends… I have found the solution: exportfig. This is a great script for Matlab that lets you A) use tight borders for the figure, B) change the colors cleverly to black and white or grayscale, C) save the figure directly as a .eps file for easy integration with LaTeX! Here’s a nice page that explains how to use the library: Exporting Figures for Publication: Part 2.

One question that I haven’t been able to solve is how to eliminate that gray border in day-to-day usage. I pretty much never want it. If anybody has any suggestions, send them my way!

And, since I have the attention of all you Matlab-ers out there, I just got R2006a (this is the newest version). This baby rocks. It has a cool feature that allows you to execute code in little blocks called ‘cells.’ This is exactly how I debug and prototype, so it saves me a lot of highlighting and pressing [F9]. Check it out if you have the means to.

One thought on “Matlab TeXniques

  1. You can override the defaults, for example:

    set(0,’DefaultFigureColor’,’white’)

    I like this one:

    set(0, …
    ‘DefaultFigureColor’, …
    get(0,’DefaultUicontrolBackgroundColor’))

    And this one for printing:

    set(0,’DefaultFigurePaperOrientation’,’landscape’, …
    ‘DefaultFigurePaperUnits’,’normalized’, …
    ‘DefaultFigurePaperPosition’,[0 0 1 1])

Leave a Reply

Your email address will not be published.