Week 1 Part 3 Fundamentals
Week 1 Part 3 Fundamentals
The following data types provide a way to store dissimilar types of data in the same
container:
• tables
• timetables
• structures
• cell arrays
There are 16 fundamental classes in MATLAB, each of these classes is in the form of a
matrix or array (more on matrices and arrays in week 2: “Arrays, Matrices and
Operators). This matrix or array is a minimum of 0-by-0 in size and can grow to an n-
dimensional array of any size.
© 2023 Introduction to Programming in MATLAB (1), Fundamentals 4
Data Types
All the fundamental MATLAB classes are shown in the diagram below:
See this table that describes the fundamental classes in more detail.
Let’s see some examples using some of these fundamental data types.
MATLAB displays strings with double quotes and character vectors with single quotes.
The difference between these two data types, is that str will be stored as a 1-by-1 string
or a string scalar whereas chr will be stored as a 1-by-12 character vector (confirm this in
the Workspace browser).
number = 25;
We can create a logical data type variable in a few ways, one of them is to use
MATLAB built-in functions, in our case we’ll use the isa function to check a variable’s data
type:
tf = isa(str, 'char') %We’re checking if str is a character, this should return a
false
Data types
• Week_1_Part_3_Fundamentals.mlx