MATLAB Programming Fundamentals - MathWorks

(やまだぃちぅ) #1
You can create two-dimensional double and logical matrices using one of two storage
formats: full or sparse. For matrices with mostly zero-valued elements, a sparse matrix
requires a fraction of the storage space required for an equivalent full matrix. Sparse
matrices invoke methods especially tailored to solve sparse problems.

These classes require different amounts of storage, the smallest being a logical value
or 8-bit integer which requires only 1 byte. It is important to keep this minimum size in
mind if you work on data in files that were written using a precision smaller than 8 bits.

The following table describes the fundamental classes in more detail.

Class Name Documentation Intended Use


double, single Floating-Point
Numbers on page
4-7



  • Required for fractional numeric data.

  • Double on page 4-7 and Single on page 4-7
    precision.

  • Use realmin and realmax to show range of values on
    page 4-11.

  • Two-dimensional arrays can be sparse.

  • Default numeric type in MATLAB.


int8, uint8,
int16, uint16,
int32, uint32,
int64, uint64


Integers on page
4-2


  • Use for signed and unsigned whole numbers.

  • More efficient use of memory. on page 29-4

  • Use intmin and intmax to show range of values on
    page 4-5.

  • Choose from 4 sizes (8, 16, 32, and 64 bits).


char, string “Characters and
Strings”



  • Data type for text.

  • Native or Unicode®.

  • Converts to/from numeric.

  • Use with regular expressions on page 2-41.

  • For multiple character arrays, use cell arrays.

  • Starting in R2016b, you also can store text in string
    arrays. For more information, see string.


Fundamental MATLAB Classes
Free download pdf