Main Content

numel

Return number of elements in DataMatrix object

Syntax

N = numel(DMObj)
Ns = numel(DMObj, Index1, Index2)

Input Arguments

DMObjDataMatrix object, such as created by DataMatrix (object constructor).
Index1A row or range of rows in DMObj specified by a positive integer or a range using the format x:y, where x is the first row and y is the last row.
Index2A column or range of columns in DMObj specified by a positive integer or a range using the format x:y, where x is the first column and y is the last column.

Output Arguments

NPositive integer representing the number of elements in DMObj, a DataMatrix object.
NsPositive integer representing the number of subscripted elements in DMObj, a DataMatrix object.

Description

N = numel(DMObj) returns 1. To find the number of elements in DMObj, a DataMatrix object, use either of the following syntaxes:

prod(size(DMObj))
numel(DMObj,':',':')

Ns = numel(DMObj, Index1, Index2) returns the number of subscripted elements in DMObj, a DataMatrix object. Index1 specifies a row or range of rows in DMObj. Index2 specifies a column or range of columns in DMObj.

Version History

Introduced in R2008b