Variables

There are several different data types in Matlab which you will run across.  The basic ones are listed below, though several additional ones can be found by visiting the help page at Mathworks.

Data TypeMatlab Class NameExplanationExample
Floating-Point NumbersSingle, DoubleThis is the default data type in Matlab. They are used to store real numbers.A = 1.25125
Integersint8, uint8,
int16, uint16,
int32, uint32,
int64, uint64
This data type is more memory efficient and allows for storage of whole numbers. "u" stands for unsigned integers while "8,16,32,64" stand for the number of bits for storage.A = uint16(256)
Characters and StringscharUsed to store text. A string is an array of characters while char signifies each one.A = 'Hello World'
BooleanlogicalUsed to store true (1) or false (0).A = true;
StructuresstructUsed to store varying lengths and types of data. The data is accessed using a name.A = struct('Name', {'Vince','Matt'},'Wonderlic Score',[6 35]);
Cell ArrayscellUsed to store varying lengths and types of data. The data is accessed using an index.A = cell(2)
Bookmark and Share