Getting Started |
Expressions
Like most other programming languages, MATLAB provides mathematical expressions, but unlike most programming languages, these expressions involve entire matrices. The building blocks of expressions are
See also Examples of Expressions.
Variables
MATLAB does not require any type declarations or dimension statements. When MATLAB encounters a new variable name, it automatically creates the variable and allocates the appropriate amount of storage. If the variable already exists, MATLAB changes its contents and, if necessary, allocates new storage. For example,
creates a 1-by-1 matrix named num_students
and stores the value 25 in its single element.
Variable names consist of a letter, followed by any number of letters, digits, or underscores. MATLAB uses only the first 31 characters of a variable name. MATLAB is case sensitive; it distinguishes between uppercase and lowercase letters. A
and a
are not the same variable. To view the matrix assigned to any variable, simply enter the variable name.
The magic Function | Numbers |
© 1994-2005 The MathWorks, Inc.