13

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?

CakeMaster
  • 1,807
  • 4
  • 16
  • 16

3 Answers3

10

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

second
  • 28,029
  • 7
  • 75
  • 76
4

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.

Dima
  • 38,860
  • 14
  • 75
  • 115
0

You could compile myfile into a standalone program and run that instead. Use Matlab's compiler mcc for that (if you have it), more information is provided in this question.

Community
  • 1
  • 1
quazgar
  • 4,304
  • 2
  • 29
  • 41