numel
Number of array elements
Syntax
Description
Examples
Input Arguments
Tips
If
Ais a table,numelreturns 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
Ais a character vector of typechar, thennumelreturns the number of characters. However, ifAis a string scalar,numelreturns1because it is a single element of a string array. For example, compare the output ofnumelfor a character vector and string:nchar = numel('mytext')nchar = 6nstr = numel("mytext")nstr = 1
Extended Capabilities
Version History
Introduced before R2006a