Main Content

numelements

Number of elements in neural network data

Syntax

numelements(x)

Description

numelements(x) takes neural network data x in matrix or cell array form, and returns the number of elements in each signal.

If x is a matrix the result is the number of rows of x.

If x is a cell array the result is an S-by-1 vector, where S is the number of signals (i.e., rows of X), and each element S(i) is the number of elements in each signal i (i.e., rows of x{i,1}).

Examples

This code calculates the number of elements represented by matrix data:

x = [1 2 3; 4 7 4]
n = numelements(x)

This code calculates the number of elements represented by cell data:

x = {[1:3; 4:6] [7:9; 10:12]; [13:15] [16:18]}
n = numelements(x)

Version History

Introduced in R2010b