MATLAB Answers

Calling a MATLAB Application file from a terminal

1 view (last 30 days)
Dylan Trainor
Dylan Trainor on 21 Nov 2020
Commented: Mario Malic on 22 Nov 2020
Hi all,
I would like to call a MATLAB application file, called "mocoPlot.mlapp" from the terminal. The line I am using is
matlab -r mocoPlot.mlapp
Normally this would work for .m files, however it seems to not be correct for .mlapp files. Once the MATLAB instance opens, the following error appears in the console:
Unable to resolve the name mocoPlot.mlapp.
Exception "java.lang.ClassNotFoundException: com/intellij/codeInsight/editorActions/FoldingData"while constructing DataFlavor for: application/x-java-jvm-local-objectref; class=com.intellij.codeInsight.editorActions.FoldingData
>>
I could not find any documentation as to why this would not work, so I am a bit stumped on what to do in order to call the .mlapp file from the terminal. If it is relevant, my MATLAB bin is added to the environment PATH and the .mlapp file sucessfully opens when done manually.
Any help/advice is appreciated.

  1 Comment

Rik
Rik on 21 Nov 2020
Maybe you need to provide the full path?

Sign in to comment.

Answers (1)

Mario Malic
Mario Malic on 21 Nov 2020
Edited: Mario Malic on 21 Nov 2020
You should provide only Application name, without extension. Also, it needs to be on MATLAB path.

  2 Comments

Rik
Rik on 21 Nov 2020
I don't know if that also holds true for apps, but for normal scripts you can also use the full path to a file you want to run. Then it doesn't need to be on the path.
Mario Malic
Mario Malic on 22 Nov 2020
One of the suggestions from the batch is not to use file extension, it might hold true for the -r option.
However, if you want to use full path then it's appropriate to pair that with run command
matlab -r "run C:\folder\app.mlapp"

Sign in to comment.

Products


Release

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!