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 > Copyright 1984-2004 The MathWorks, Inc. Version 220.127.116.1101 (R14) May 06, 2004 To get started, type one of these: helpwin, helpdesk, or demo. For product information, visit www.mathworks.com. c = 5