While one can easily install MATLAB by following instructions from Community Ubuntu Documentation for MATLAB, Still there is a common glitch is the file association of matlab scripts, figures and *.mat files. One cannot directly open them by simply double clicking on them in the file manager in Ubuntu/Linux OS, which is a cool feature on Windows or Mac OS.
Here is a pretty quick way do solve the above problem.
- Make a Desktop Entry file, with the following contents:
Save the file with a filename MATLAB-Open.desktop
Exec=matlab -desktop -r "open %f"
- Place the file in the ~/.local/share/applications directory:
mv MATLAB-Open.desktop ~/.local/share/applications
- That's all. Open a new nemo/nautilus window, navigate to any directory containing matlab script (*.m) OR figure (*.fig) files. Right click the file, and choose 'Open with Other application', and choose 'Show other applications'. Here you can choose MATLAB-Open from the 'Other applications' list.The next time you double click on any matlab script file, that will automatically open in matlab.
- Repeat step 3 for matlab figure files (*.fig) also.
TO THOSE WHO USE NEMO FILE MANAGER, THERE IS ADDITIONAL (OPTIONAL) INFORMATION BELOW:
Make a file named 'Open in MATLAB' with the following contents
Save the file, make the file executable, and place it in ~/.gnome2/nemo-scripts directory.
matlab -desktop -r "cd %d"
Now you can launch matlab session from within any directory, and drag and drop the figure files or script files into matlab window to execute them. It is done by right clicking in file manager and selecting 'scripts >> Open in MATLAB' within the context menu.
mv 'Open in MATLAB' ~/.gnome2/nemo-scripts