How To Declare Variables in MATLAB.?


Want to declare the variables in MATLAB and looking for support, If, yes it’s very simple “All these things you no need aware of MATLAB”. If you have any coding basic knowledge, which is much appreciated to understand declaration of variables in MATLAB module.

Before MATLAB Declaration, You have to ready with MATLAB software in that, Open Command Window and Workspace window…. these two windows help to understand of Declaration of Variables. Where Command Window helps to enter the all listed or assumed Variables and Workspace Window helps to store all inserted Variables in Command Window.

Command Window Role:

All variable declaration must be done under the Command window, If you enter any type variables either text, expression or symbolic variables, all these variable are saved in workspace window. So, these two windows always interconnected between them.

For example:



Here a and b are assumed variables which are declared using assumed constant numbers which are 3 and 5. Add this variable using SUM keyword or directly add them using Plus (+) symbol.





Hence the third variable save 8 in that, which is located in Workspace window, please look at there.

Another Example:


=> 8+7;

=>15 // it is outpur of above expression.



=> 0 4 8 12 16

Explanation: 1 is initial value and 16 is a final value and middle is expnasion of each value (addition of intial value in every intraval of time 0+4=4; 4+4=8; 8+4=12; 12+4=16). this type variables can use in Matrix formation under same size.

WorkSpace Window Role:

WorkSpace Windows role to store all variables and it provides whenever required on call process. Once any parameter is declared then it automatically stored and saved, when you required the same variable in any other expression than just type parameter (say a or b) the output value is inserted in it (say 3 or 5).

for practise purpose, you use any type operations like arithmetic and matrix oriented operations and check out result in the command window and observe stored values in workspace window.


Please enter your comment!
Please enter your name here