Fixing font sizes in MATLAB under Ubuntu

MATLAB runs in Ubuntu 12.04 without any major problems. However, one issue that I noticed was that changing the font size in figures has no effect; the text always appears in default (small) size in Matlab. The correct font size has an effect only in exported PDF and EPS files. The font spacing is incorrect though, as it seems to be based on the fonts that Matlab uses. As Matlab is often used (only?) for making figures, this can be a major problem.

As mentioned in this thread, the problem is related to Matlab not finding the correct fonts in Ubuntu OS. As a remedy install the following packages:

sudo apt-get install xfonts-100dpi xfonts-75dpi

and logout and login again. Matlab should now be able to show the plots in correct size. The fonts do not look pretty, though, which is probably related to broken anti-aliasing. Maybe there are other broken dependencies?
However, exported PDF and EPS files should now have the correct font spacing (e.g. the size of the legend box) and should be usable.

Installing 32-bit MATLAB on 64-bit Linux (Ubuntu)

Currently 64-bit Linux distributions are stable and well established so there are virtually no problems in opting for a 64-bit system.
However, some MATLAB Linux versions, notably the student version, only exists in 32-bit and it is not so obvious to get it installed in 64-bit Linux environment.

Here’s how I got it done (MATLAB R2009a in Ubuntu 10.04 Lucid):
1) Install some 32-bit libraries:
sudo apt-get install ia32-libs lib32ncurses5
2) Mount the CD (e.g. open the content in a file manager)
3) Install MATLAB, force to use the 32-bit executable:
sudo /media/cdrom0/install_unix.sh -glnx86
Install matlab to some convenient place, typically /usr/local/matlab (assumed here).
The installation will fail, complaining about 64-bit java.
4) Fix the java problem (change the path according to your installation):
sudo ln -s /usr/local/matlab/sys/java/jre/glnx86/ /usr/local/matlab/sys/java/jre/glnxa64
5) Register your matlab
sudo /usr/local/matlab/bin/activate_matlab.sh
6) You can now run MATLAB:
matlab -glnx86

%d bloggers like this: