Main Content
numel
Number of array elements
Syntax
Description
Examples
Input Arguments
Tips
If
A
is a table,numel
returns the number of elements in the table,A
, equivalent toprod(size(A))
. Variables in a table can have multiple columns, butnumel(A)
only accounts for the number of rows and number of variables.If
A
is a character vector of typechar
, thennumel
returns the number of characters. However, ifA
is a string scalar,numel
returns1
because it is a single element of a string array. For example, compare the output ofnumel
for a character vector and string:nchar = numel('mytext')
nchar = 6
nstr = numel("mytext")
nstr = 1
Extended Capabilities
Version History
Introduced before R2006a