Write variable in MATLAB

MATLAB using the variable as a medium for the programmer to place the data input/output. There are several ways of writing the data that you can use according to the type of data to be processed. They are :
1. Single Numerical Data
in writing :
a = 5

translated by MATLAB as:
a =

2. Multidimensional Numerical Data (Array/Matrice)
In writing :
a = [ 5 10; 20 25]

Some thing that are important in the use of MATLAB command:
- Sign ( ; ) at the end of the command shows the command execution results are not displayed on the screen
- sign ( [] ) at the end of the command indicates the beginning and end of boundary element matrices
- sign ( ; ) in the declaration of the matrix used for the separation between rows in the matrix
- sign ( , ) in the declaration of the matrix is equal to spaces or separators between elements in a row matrix

If we press enter, program above will be translated by Matlab as follows:
a =
5 10
20 25

3. Text/String Data
In writing :
>> a = 'mike'

translated by Matlab as:
a =

Important Tips:
1. Variable naming is Case Sensitive, it means MATLAB will differentiate between upper and lower case in naming. For example 'width' is not same with 'Width'.
2. Variable Name length can not exceed 31 characters
3. Naming variable must always begin with letter, not with numbers, symbol, etc.


Post a Comment