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:
Code:
[Desktop Entry]
Version=1.0
Encoding=UTF-8
Type=Application
Name=matlab
NoDsiplay=true
Exec=matlab -desktop -r "open %f"
Name[en]=MATLAB-Open
Icon=/usr/share/icons/matlab.png
Save the file with a filename MATLAB-Open.desktop - Place the file in the ~/.local/share/applications directory:
Code:
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
Code:
#!/bin/sh
matlab -desktop -r "cd %d"
Save the file, make the file executable, and place it in ~/.gnome2/nemo-scripts directory.
Code:
mv 'Open in MATLAB' ~/.gnome2/nemo-scripts
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.
Bookmarks