my:
matlab r2012a for Linux x64
gcc 4.7
g++ 4.7
step 1:
install gcc-4.4 and g++-4.4
sudo apt-get install gcc-4.4
sudo apt-get install g++-4.4
step 2:
change default choice of compiler
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.4 50
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.4 50