Here is an excerpt from the above link in case it is broken:
**** The following tip works on Ubuntu 8.10 running GNOME 2.24.1 but I imagine that a similar procedure would work for some other setups as well.
1. Right click on any .m file you like and, in the menu, click on:
Open With->Open With Other Application
2. Click on the arrow to the left of Use a custom command
3. In the resulting dialogue box type:
4. Click on Open. MATLAB will start up and then the editor will open your file. In future you will not need to type the above command because GNOME will have added an extra item to the Open With menu – namely Open with “matlab” ****