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?
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.
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.
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.
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With