You are on page 1of 2

c  




There are many different data types or Classes in MATLAB.
There are 15 fundamental classes in MATLAB. Each of these classes is in the form of a
matrix or array. This matrix or array is a minimum of 0-by-0 in size and can grow to an n-
dimensional array of any size.
The encircled data types are fundamental data types.

uÊ By default every variable is floating type with double precision (8 byte). The 52 bits
are reserved for mantissa part.
uÊ 0e can convert from one data type to another by using these classes. eg

a = 45;

a = uint16(a); or a = int16(a); or a = uint32(a)


The following table describes these classes in more detail.

i  
      

O D á  Floating-Point Numbers Ê required for fractional numeric data.


Ê Double and Single precision.
Ê Use   and  to show range of values.
Ê Two-dimensional arrays can be sparse.
Ê Default numeric type in MATLAB.

  Integers


Ê Use for signed and unsigned whole numbers.
 

 
 Ê More efficient use of memory.
   Ê Use   and  to show range of values.
Ê ihoose from 4 sizes (8D 16D 32D and 64 bits).

˜  iharacters and Strings Ê required for text.


Ê Native or unicode.
Ê ionverts to/from numeric.
Ê Use with regular expressions.
Ê For multiple stringsD use cell arrays.

  ˜ Logical ilass Ê Use in relational conditions or to test state.


Ê ian have one of two values:  or á.
Ê Also useful in array indexing.
Ê Two-dimensional arrays can be sparse.

function_handle Function Handles Ê Pointer to a function.


Ê Enables passing a function to another function
Ê ian also call functions outside usual scope.
Ê Useful in Handle Graphics callbacks.
Ê Save to MAT-file and restore later.

Ꮨ Structures Ê Fields store arrays of varying classes and sizes.


Ê Access multiple fields/indices in single operation.
Ê Field names identify contents.
Ê Simple method of passing function arguments.
Ê Use in comma-separated lists for efficiency.
Ê More memory required for overhead

˜ iell Arrays Ê iells store arrays of varying classes and sizes.
Ê Allows freedom to package data as you want.
Ê Manipulation of elements is similar to arrays.
Ê Simple method of passing function arguments.
Ê Use in comma-separated lists for efficiency.
Ê More memory required for overhead

You might also like