number of indexable elements - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : Data Types : Tables, lists, and sets : numelems

numelems  - number of indexable elements

Calling Sequence

numelems(expr)

Parameters

expr

-

expression

Description

• 

The numelems(expr) command returns the number of elements in expr.  

• 

This command works on all expressions of type indexable.  

• 

If expr is an array, matrix or vector, the number of elements as represented by the bounds of the array is returned.  A 2x3 matrix will have 6 elements as reported by numelems, even if some of those elements are not assigned.  The same result will be returned if the matrix is sparse, or has another special storage as compared to a dense rectangular matrix.

• 

If expr is a string, the number of characters in expr is returned.

• 

If expr is a table, the number of assigned entries is returned.  

• 

If expr is a list or set, the number of first-level indexable elements is returned.  That is, a list containing two 5-element sublists will still have two elements as reported by numelems.  This is the same result given by nops.

Examples

numelems1|2,3|4

4

(1)

numelems1,2,3,4

4

(2)

numelems1,2,3,4

2

(3)

numelemstable1=1,2=2,3=3

3

(4)

numelemsabc

3

(5)

See Also

nops, ArrayTools[NumElems], rtable_num_elems, entries, indices, length, upperbound, lowerbound


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam