DATATYPE:-

                The data types may be defined as
      • Type of value to be stored
      • Memory requirement of the variable
Generally MATLAB does not require any type of declaration of dimension i.e. in MATLAB we don’t have to declare the data type of the variable unless when we are creating a new variable name.

It creates the new variable and allocates its proper memory to it.

If the created variable is already present it replaces it with the older one and freed the allocated memory to provide where it is necessary.
For example:-
We want to create a variable which is associated with Character Data Type.
Let us understand it with a simple program.
X=[77 65 84 76 65 66];
C= char(X)

Ans=
                ‘MATLAB’

Note:-
  • For understanding char data type you have to memorize the ASCII codes
  • For understanding int data type you have to learn (signed, unsigned) integer, which is discussed below.

Signed & Unsigned Integer in MATLAB:-

It can be easily understandable through the below picture.

Data Types used in MATLAB:

Overall there are 15 fundamental data types are used in MATLAB.
These data types are stored in the form of matrix.
They can store value 0 by 0 and this can grow as higher they can store as matrix.
Data
Type Description
int8
8-bit signed integer
uint8
8-bit unsigned integer
int16
16-bit signed integer
uint16
16-bit unsigned integer
int32
32-bit signed integer
uint32
32-bit unsigned integer
int64
64-bit signed integer
uint64
64-bit unsigned integer
single
single-precision numerical data
double
double precision numerical data
logical
logical values of 1 or 0, represent true and false respectively
char
character data (strings are stored as a vector of characters)
cell array
array of indexed cells, each capable of storing an array of a different dimension and data type
Structure
C-like structures, capable of shorting an array of a different dimension and datatype
function handle
pointer to a function
user classes
objects constructed from a user-defined class
java classes
objects constructed from a Java class

Extra Knowledge:-
  • In MATLAB integer data can be stored as 1-,2-,4-,8- Bytes. It detects automatically how much memory requires your variable and according to that, it allocates the memory.
  • Single or single-precision variables can store 32-bits or 4 Bytes floating-point variables (i.e 0.000000)
  • Double is default numeric data type which can hold variable value of 64-bits or 8- Bytes double-precision floating-point automatically.

(IT SHOWS THE MEMORY REQUIREMENT OF INTEGER CLASS OF MATLAB)

contact-form




Post a Comment

If you have any doubts regarding this topic...
feel free to ask...

Previous Post Next Post