How To Create Variables In Matlab

To create or assign variables to data in Matlab we can just use the equal sign symbol “=”. This is also known as the assignment operator.

In order to create a variable, you first need to type the variable name, followed by the assignment operator “=”, and then the value you want to assign to the variable name.

So, let’s say for instance I wanted to assign the value 5 to the variable “apple”.

Then it would look something like this.

apple = 5 

Once, you have assigned the value. The variable “apple” is now stored in Matlab, so whenever you want to access the number of apples that you have, you can just type our variable name “apple”.

Also, notice in the image above, on the right-hand side, beneath “workspace” we can see our variable stored in our workspace.