I had the same issue. I just now fixed it. In ubuntu 18.04. which I had previously I just installed the matlab application from the Ubuntu Software app. But in ubuntu 20.04 you need to use the Software app
And there install the package:
This will create the matlab.desktop file and from there you can just follow the instructions you linked (adding -r "edit %f" after the launch command). Hope this helps.
Can you explain where to add r "edit %f" and how that tells ubuntu to open *.m with MATLAB.
I have a related problem. Maybe I should ask in a new thread, but:
MATLAB is trying to run an update. My MATLAB is installed for my user only in ~/.local . When I attempt to update, I get a permissions error. My user account doesn't have write permission to ~/.local/share/MATLAB/R2020a. I tried launching MATLAB with sudo matlab but this fails because my MATLAB license is tied to my username; it won't launch for user root. How can I update??
1) if you look at the package description that I included it tells you, the package does not include an installation of matlab. Instead it creates matlab.desktop for you (autmatically and correctly - but I'm not sure how it handels non-default installation directories) as well as it does some other magic to make sure MATLAB shows up in the open with context menu. Then you can just click on propperties and set MATLAB as default for any .m file.
2) If you are here and you can launch MATLAB just by double clicking a .m file. You will see that your MATLAB opens in your home directory and no script tab is open, only the commant line. So at this state you are forced to manually find the file you previously clicked inside matlab's "open file". This is where the <-r "edit %f"> comes in. It enables ubuntu passing arguments with MATLAB when launching it. Arguments, such as, the file you double clicked.
Lastly, the way I got it working was: Install MATLAB from .deb file using the Software app (not the Ubuntu Software app), used deafult installation path. Installed the MATLAB (community patch) package from the Software app, opened matlab.desktop and appended the <-r "edit %f"> at the end of "Exec=/..." line. Then restarted my machine.
The quotes are really important. Without them, MATLAB just opens an empty editor because the filename is parsed as a separate argument to MATLAB, rather than part of the command for MATLAB to run.
Changing the .desktop file in this way makes MATLAB open with an empty editor window if you're just launching MATLAB directly from its icon. There must be a way to make the -r "edit %f" part conditional. I'm creating a separate question about that.
Impossibile completare l'azione a causa delle modifiche apportate alla pagina. Ricarica la pagina per vedere lo stato aggiornato.
Translated by
Seleziona un sito web
Seleziona un sito web per visualizzare contenuto tradotto dove disponibile e vedere eventi e offerte locali. In base alla tua area geografica, ti consigliamo di selezionare: .
Puoi anche selezionare un sito web dal seguente elenco:
Come ottenere le migliori prestazioni del sito
Per ottenere le migliori prestazioni del sito, seleziona il sito cinese (in cinese o in inglese). I siti MathWorks per gli altri paesi non sono ottimizzati per essere visitati dalla tua area geografica.