This example shows several ways to assign a value to a variable.
x = 5.71; A = [1 2 3; 4 5 6; 7 8 9]; I = besseli(x,A);
You do not have to declare variables before assigning values.
If you do not end an assignment statement with a semicolon (
;), MATLAB® displays
the result in the Command Window. For example,
x = 5.71
x = 5.7100
If you do not explicitly assign the output of a command to a
variable, MATLAB generally assigns the result to the reserved
ans. For example,
ans = 5.7100
The value of
ans changes with every command
that returns an output value that is not assigned to a variable.