Download Sysquake Remote User Manual

Transcript
LME Reference — arrays
261
Syntax
n = length(v)
n = length(list)
Description
length(v) gives the length of vector v. length(A) gives the number of elements along the largest dimension of array A. length(list)
gives the number of elements in a list.
Examples
length(1:5)
5
length((1:5)’)
5
length(ones(2,3))
3
length({1, 1:6, ’abc’})
3
length({{}})
1
See also
size, numel, end
magic
Magic square.
Syntax
M = magic(n)
Description
A magic square is a square array of size n-by-n which contains each
integer between 1 and n2 , and whose sum of each column and of each
line is equal. magic(n) returns magic square of size n-by-n.
There is no 2-by-2 magic square. If the size is 2, the matrix [1,3;4,2]
is returned instead.