© Michael Paluszek and Stephanie Thomas  2019
Michael Paluszek and Stephanie ThomasMATLAB Machine Learning Recipeshttps://doi.org/10.1007/978-1-4842-3916-2_2

2. Representation of Data for Machine Learning in MATLAB

Michael Paluszek1  and Stephanie Thomas1
(1)
Plainsboro, NJ, USA
 

2.1 Introduction to MATLAB Data Types

2.1.1 Matrices

By default, all variables in MATLAB are double precision matrices. You do not need to declare a type for these variables. Matrices can be multidimensional and are accessed using 1-based indices via parentheses. You can address elements of a matrix using a single index, taken column-wise, or one index per dimension. To create a matrix variable, simply assign a value to it, such as this 2x2 matrix a:

 >> a = [1 2; 3 4];

Get MATLAB Machine Learning Recipes: A Problem-Solution Approach now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.