MATLAB POLYSPACE RELEASE NOTES Manuale Utente Pagina 33

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 240
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 32
Expressions
Expressions
In this section.. .
“Variables” on page 2-11
“Numbers” on page 2-12
“Operators” on page 2-12
“Functions” on page 2-13
“Examples of Expressions” on page 2-14
Variables
Like most other programming languages, MATLAB provides mathematical
expressions, b ut unlike most programming languages, these expressions
involve entire matrices.
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 a ppropriate amount of storage. If the variable
already exists, MATLAB changes its contents and, if necessary, allocates
new storage. For example,
num_students = 25
creates a 1-by-1 matrix n
amed
num_students and stores the value 25 in its
single element. To view
the matrix assigned to any variable, simply enter
the variable name.
Variable name s co nsist
of a letter, followed by any number of letters, digits, or
underscores. MATLAB i
s case sensitive; it distinguishes between uppercase
and lowercase letters
.
A and a are not the same variable.
Although variable nam
es can be of any length, M ATLAB uses o nly the first
N characters of the nam
e, (where
N is the number returned by the func tion
namelengthmax), and i
gnores the rest. Hence, it is important to make
each variable name un
ique in the first
N characters to enable MATLAB to
distinguish variabl
es.
N = namelengthmax
2-11
Vedere la pagina 32
1 2 ... 28 29 30 31 32 33 34 35 36 37 38 ... 239 240

Commenti su questo manuale

Nessun commento