© Michael Paluszek, Stephanie Thomas  2017

Michael Paluszek and Stephanie Thomas, MATLAB Machine Learning, 10.1007/978-1-4842-2250-8_4

4. Representation of Data for Machine Learning in MATLAB

Michael Paluszek and Stephanie Thomas1

(1)New Jersey, USA

4.1 Introduction to MATLAB Data Types

4.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, like this 2 × 2 matrix a:

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

>> a(1,1)

     1

>> a(3)

     2

You can ...

Get MATLAB Machine Learning 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.