Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Matlab - run file without opening GUI, then quit

Tags:

linux

unix

matlab

I want Matlab to run some .m file, which writes to a text file. I don't want the GUI to launch, and I don't want the command line interpreter to run. I've got

matlab -nodisplay -r myfile

But this still runs the interpreter. What options should I be using?

like image 588
CakeMaster Avatar asked Aug 30 '10 15:08

CakeMaster


People also ask

How do I run a MATLAB script without GUI?

If you need to execute a matlab script you can do matlab -nodisplay < script. m . If you want to call a matlab function, you can do matlab -nodisplay -r "foo(); quit" . IIRC, in both cases matlab should exit once it is done.

Can I run MATLAB script from command line?

To run a MATLAB script from the the command line, use MATLAB's -r option, as in this example which runs the Matlab script my_simulation. m from the current directory. Note that the MATLAB script that you run should have an exit command in it.

How do you exit a MATLAB script?

Ways to Quit or ExitClick the close button on the MATLAB® desktop. Click. on the left side of the desktop title bar and select Close. Type quit or exit at the command prompt.


2 Answers

If you need to execute a matlab script you can do matlab -nodisplay < script.m. If you want to call a matlab function, you can do matlab -nodisplay -r "foo(); quit". IIRC, in both cases matlab should exit once it is done.

like image 93
Dima Avatar answered Sep 30 '22 17:09

Dima


matlab needs to interpreter to run your commands. you can always end your file with quit to make matlab exit again when finished with your calculations

like image 28
second Avatar answered Sep 30 '22 19:09

second