Fundamental MATLAB Classes

There are 16 fundamental classes in MATLAB. Each of these classes is in the form of a matrix or array. With the exception of function handles, this matrix or array is a minimum of 0-by-0 in size and can grow to an n-dimensional array of any size. A function handle is always scalar (1-by-1).

All of the fundamental MATLAB classes are shown in the diagram below:

Numeric classes in the MATLAB software include signed and unsigned integers, and single- and double-precision floating-point numbers. By default, MATLAB stores all numeric values as double-precision floating point. (You cannot change the default type and precision.) You can choose to store any number, or array of numbers, as integers or as single-precision. Integer and single-precision arrays offer more memory-efficient storage than double-precision.

All numeric types support basic array operations, such as subscripting, reshaping, and mathematical operations.

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

doublesingle Floating-Point Numbers
int8, uint8, 
int16, uint16,
int32, uint32,
int64, uint64
Integers
char Characters and Strings
  • Data type for text.

  • Native or Unicode®.

  • Converts to/from numeric.

  • Use with regular expressions.

  • For multiple strings, use cell arrays.

logical Logical Operations
  • Use in relational conditions or to test state.

  • Can have one of two values: true or false.

  • Also useful in array indexing.

  • Two-dimensional arrays can be sparse.

function_handle Function Handles
  • Pointer to a function.

  • Enables passing a function to another function

  • Can also call functions outside usual scope.

  • Useful in Handle Graphics callbacks.

  • Save to MAT-file and restore later.

table Tables
  • Rectangular container for mixed-type, column-oriented data.

  • Row and variable names identify contents.

  • Use Table Properties to store metadata such as variable units.

  • Manipulation of elements similar to numeric or logical arrays.

  • Access data by numeric or named index.

  • Can select a subset of data and preserve the table container or can extract the data from a table.

struct Structures
  • Fields store arrays of varying classes and sizes.

  • Access one or all fields/indices in single operation.

  • Field names identify contents.

  • Method of passing function arguments.

  • Use in comma-separated lists.

  • More memory required for overhead

cell Cell Arrays
  • Cells store arrays of varying classes and sizes.

  • Allows freedom to package data as you want.

  • Manipulation of elements is similar to numeric or logical arrays.

  • Method of passing function arguments.

  • Use in comma-separated lists.

  • More memory required for overhead


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值