Please enable JavaScript to view this site.

Knowledge Base

Navigation: Scripting Language > Functions

length

We've made some changes. Use 'Ctrl-F5' to clear your browser cache.
Scroll Prev Top Next More

Returns the number of elements in a matrix. If the argument is a string, it will return the length of the string.

 

Supported Product: FDTD, MODE, DEVICE, INTERCONNECT

 

Syntax

Description

y = length(x);

y the number of elements in a matrix. For example, if x is an n by m matrix, y = length( x ) = n * m.

 

Example

Find the length of a matrix and of a string.

x=matrix(2,3,3);

?y=length(x);

result: 

18 

 

?length("hello");

result:

5  

 

See Also

Functions, size, transpose, flip, substring, findstring, replace, replacestring

Copyright Lumerical Inc. | Privacy | Site Map