Programming |
|
Guidelines to Using Variables
The same guidelines that apply to MATLAB variables at the command line also apply to variables in M-files:
- You do not need to type or declare variables used in M-files (with the possible exception of designating them as
global
or persistent
).
- Before assigning one variable to another, you must be sure that the variable on the right-hand side of the assignment has a value.
- Any operation that assigns a value to a variable creates the variable, if needed, or overwrites its current value, if it already exists.
| Naming Variables | | Scope of a Variable | |
© 1994-2005 The MathWorks, Inc.