Lexi
Lexi

Reputation: 57

What is the default variable in MATLAB?

What is the default variable in MATLAB if you do not assign one to an equation? I was thinking it was maybe just x?

Upvotes: 3

Views: 559

Answers (1)

Adriaan
Adriaan

Reputation: 18187

The answer is ans, this is also shown in the workspace which contains the variables. Consider this example input in the command line:

3*4

ans = 
      12

Just be sure never to use ans as an actual variable, as that'll mess up your code good.

Upvotes: 6

Related Questions