- Right-click a .m file and click
Properties
- Click the
Open With
tab then clickAdd
- Expand
Use custom command
and type the following into the field:
matlab -desktop -r "f=%f; cd(fileparts(f)); edit(f); clear f;"
- Click
Add
then select the radio button next tomatlab
. - Close the property window.
If you'd like to know what that command does:
matlab
: to run Matlab-desktop
: to run Matlab without using a terminal-r
: execute following matlab code when Matlab opensf=%f
: Save filename of file to open to variable f
cd(fileparts(f))
: change the current directory to file f
's directoryedit(f)
: open file f
for editingclear f
: delete the matlab variable f
6 comments:
It is a pity, that now I can not express - I am late for a meeting. I will return - I will necessarily express the opinion on this question.
And it is effective?
It does work... but sometimes linux confuses other text files for matlab files, so they open in matlab, too. This is very annoying.
This could be useful to the ubuntu package "matlab-support" and to the rest of the community.
Would you mind writing to the mantainer, or if I did it?
This could be useful to the ubuntu package "matlab-support" and to the rest of the community.
Would you mind writing to the mantainer, or if I did it?
@Poomerang: Not at all, that's a great idea! I use that package myself. I don't have the contact details, but please go ahead and contact the developer. Use my code as you wish :-)
Post a Comment