MATLAB on Ubuntu: libstdc++ errors on system() or unix() calls

To fix the Matlab error about the version of libstdc++ being wrong when using the system() or unix() calls from Matlab:

cd /usr/local/MATLAB/R2013a/sys/os/glnxa64
sudo mkdir obsolete
sudo mv libstdc* obsolete/
sudo ln -s /usr/lib/x86_64-linux-gnu/libstdc* ./

Example triggering Matlab error

Calling gnucap from Matlab, I would get the error:

gnucap: /usr/local/MATLAB/R2013a/sys/os/glnxa64/ version ‘GLIBCXX_3.4.15’ not found (required by gnucap)

when running in Matlab

unix('gnucap -b')