Howto Run a Matlab Script With a Shell

Please use an editor that you like to write a matlab script as following:

a=3;
b=2;
c=a+b


Save as num.m (a matlab script).

Then, use the editor vi or gedit to write a shell script as following:

Save as a shell script num.sh.

Now, you can run the matlab script from within a shell script as follows:

There is a result string information printed on the terminal, showed as following:

Warning: Could not access OpenGL library

< M A T L A B >