Matlab FAQ

This document covers the queries about matlab that are reported most often to help. Information about running matlab and its licenses is in the main matlab notes.

Useful Links

Questions

  1. Is there a way to run matlab and then exit the terminal without killing matlab?

  2. I'm running matlab from one host to another, why is it slower and what can I do about it.

  3. I'm trying to run matlab on pal from hoover. I get the following message when it starts:
      pal:~ 13:45:10$ matlab
      Xlib: connection to ":0.0" refused by server
      Xlib: No protocol specified
      libGL error: failed to open DRM: Operation not permitted
      libGL error: reverting to (slow) indirect rendering
    
  4. How can I make my eps converted matlab images smaller

  5. I receive an Invalid MEX-file error like
      ??? Invalid MEX-file '/opt/matlab-r.../toolbox/symbolic/maplemex.mexglx':
      ....applic/com/matlab-r.../bin/glnx86/libmaple.so: symbol
      errno, version GLIBC_2.0 not defined in file libc.so.6 with link time
      reference.
    
  6. Compiler mcc -? does not work
     mcc -?
    cc: unrecognized option '-?'
    /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../crt1.o: In function `_start':
    (.text+0x18): undefined reference to `main'
    collect2: ld returned 1 exit status
    

Answers

  1. Is there a way to run matlab and then exit the terminal without killing matlab?

    Mathworks answer to this: http://www.mathworks.com/support/solutions/data/1-15F5B.html simply calls matlab with no DISPLAY set and with stdin/stdout re-directed and using nohup to protect it from HUP signals (HangUp which happens when you log out).

    Their csh script is largely trivial, and can be done as sh or bash with something like:
      #! /bin/sh
      unset DISPLAY
      nohup matlab < $1 > $2 &
    
    though that stderr should probably also be re-directed and you may need other matlab options too to tell it what to do.

  2. I'm running matlab from one host to another, why is it slower and what can I do about it.

    Running displaying remotely will usually be slower at drawing to the screen than running on the local machine.

    Running over ssh is sometimes slower than using X directly but this is only noticable on either very slow machines or if doing very complex graphics.

    You can tell matlab to bypass ssh and display directly, e.g. in the case where pal is the remote machine:

      DISPLAY=pal:0 matlab
    

    though in general you need to know the name of the local machine to set DISPLAY to. You will still get some warnings but not explicit GLX ones. (see next question)

    To help people doing this we arrange that the first use of the slog command adds a record to the server resources, so that it can be extracted later.

    A script to use them can be found in ~jp107/scripts/plainx so you could say:
      ~jp107/scripts/plainx matlab
    
    though it is rarely needed these days.

  3. I'm trying to run matlab on pal from hoover. I get the following message when it starts:
       pal:~ 13:45:10$ matlab
      Xlib: connection to ":0.0" refused by server
      Xlib: No protocol specified
      libGL error: failed to open DRM: Operation not permitted
      libGL error: reverting to (slow) indirect rendering
    
    During startup the GL code attempts to talk to the X server on the local machine - which isn't the right machine in cases like this. It does this if X claims to support GL (3d rendering code) and the client code also has been compiled with GL support.

    The bug is in the GL/GLX library/support code not matlab, all GL applications mis-behave in a similar way.

    It reports that we can't do DRM so it reverts to slower indirect rendering. This is for the 3d support only, which does not work remotely anyway.

    In fact the DRM (fast 3d drawing etc) support on many graphics cards is still sufficently buggy that we have ended up turning it off for some machines anyway.

  4. How can I make my eps converted matlab images smaller For example Making Matlab Images used in eps files smaller for inclusion in a paper.

    An eps file can be big mostly because it contains several eps files exported from matlab. Matlab often generates eps files which are either very (very) large or very poor quality (if for example you try to grab it from the screen or lower the resolution later.

    Now it may be that there is too much detail in the images which matlab is outputting so you *might* be able to tell it to render at some lower resolution (which will still look fine when printed etc).

    To help with this mathworks produced some helper .m files referenced in:

    Of course you may find that even using the exportfig command (described in the first 2 articles), you can't get the resulting eps file sizes down very much.

    If the article is intended for publication in a web-based journal you can probably get away with dropping the resolution down a great deal (which may help the sizes).

    e.g. exportfig(... 'bounds','tight', 'Resolution', 100, ... )

    there are many (many) options to exportfig, type "help exportfig" for a list of a few more!

    If all else fails you can probably squeeze a little space by converting to PDF and including that in your document (PDF files can be compressed internally).

  5. I receive an Invalid MEX-file error.

    If you receive an error along the lines of:
      ??? Invalid MEX-file '/opt/matlab-.../toolbox/symbolic/maplemex.mexglx':
      ....applic/com/matlab-.../bin/glnx86/libmaple.so: symbol
      errno, version GLIBC_2.0 not defined in file libc.so.6 with link time
      reference.
    
    Then start matlab with the -notls option as in:
      matlab -notls
    
    The -notls option can be combined with other matlab options for example:
      matlab -nojvm -nosplash -notls
    
    As far as we can tell this is only a problem with maple add on toolboxes and only in older versions of Matlab. For more information see news items about -notls.
  6. Matlab Compiler - mcc

    To run the Matlab compiler (mcc) you need to call the explicit version, such as mcc-r2008b (this is because the Mathematica mcc compiler is also installed on the DAMTP UNIX system and has the same name).