Documentation Center

  • Trial Software
  • Product Updates

Create Variables

This example shows several ways to assign a value to a variable.

x = 5.71;
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 =

If you do not explicitly assign the output of a command to a variable, MATLAB generally assigns the result to the reserved word ans. For example,



ans =


Was this topic helpful?