Is it possible to run Matlab commands from Mac command line?
Type the script name on the command line and press Enter. For example, to run the numGenerator. m script, type numGenerator . On the Editor tab, click the Run button.
To start MATLAB® on Linux platforms, type matlab at the operating system prompt. If you did not set up symbolic links in the installation procedure, then type matlabroot /bin/matlab . matlabroot is the name of the folder in which you installed MATLAB.
The Command Window enables you to enter individual statements at the command line, indicated by the prompt (>>). As you enter statements, the Command Window displays the results. For example, to create the variable a , type a = 1 at the command line and press Enter.
The matlab
script is in the bin
subdirectory of the MATLAB app bundle. On my machine, this means I can run it like so:
/Applications/MATLAB_R2012a_Student.app/bin/matlab
If you want this bin directory on your path (so that you can just run matlab
, mex
, etc), edit or create a new text file called .bash_profile
in the top level of your home directory with the following line:
export PATH=/Applications/MATLAB_R2012a_Student.app/bin:$PATH
Replacing the "MATLAB_R2012a_Student" part with the name of your actual MATLAB app bundle. This will not come into effect for currently open terminals, but newly opened terminals should work properly.
You need the full path to the MATLAB executable, and you can use the -r
option to run a command in the MATLAB that you start, as per the doc here.
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