Sunday, October 13, 2013

MATLAB: A Syntactical Look

After opening MATLAB you should see the command window . You can recognize this by seeing the command prompt  >>

Note: In MATLAB comments are written after % symbol
Lets start with some simple commands

Command              
>>clc    % This is used to clear the the command screen
>>clear  % Is used to clear the variables


These commands are very basic

Now let us look at a few more commands. If we want to create a variable its very simple

>>a=1 % This creates a variable a with value 5

Few more variables
>> b=5  % b=5
>> c=3.14 % c=3.14
>>name='Vijay'    % creates a string variable  of name=Vijay

The best part is we need not define if the variable is a integer float or string MATLAB takes care of all this stuff . That is why it is a weakly typed language

MATLAB Basic Commands

So if we need to create a variable just use a variable_name = value ....
thats it. The only thing to note here is the variable_name should not be a inbuilt function name or predefined name

In the next post we will write a few basic MATLAB scripts  ..


No comments:

Post a Comment