Sequence of MATLAB statements in file
A script file is an external file that contains a sequence of MATLAB® statements.
By typing the filename, you can obtain subsequent MATLAB input
from the file. Script files have a filename extension of
Scripts are the simplest kind of MATLAB program. They are
useful for automating blocks of MATLAB commands, such as computations
you have to perform repeatedly from the command line. Scripts can
operate on existing data in the workspace, or they can create new
data on which to operate. Although scripts do not return output arguments,
any variables that they create remain in the workspace, so you can
use them in further computations. In addition, scripts can produce
graphical output using commands like
Scripts can contain any series of MATLAB statements. They require no declarations or begin/end delimiters.
Like any MATLAB program, scripts can contain comments.
Any text following a percent sign (
%) on a given
line is comment text. Comments can appear on lines by themselves,
or you can append them to the end of any executable line.