Next: , Up: Directory Index   [Contents][Index]


2.1 array-handling

Function File: A = arrayflatten ( X, … )

Flatten the arguments X, … into one array vector A.

Examples

assert(all(arrayflatten([]) == []))
assert(all(arrayflatten([1]) == [1]))
assert(all(arrayflatten([1,2]) == [1,2]))
assert(all(arrayflatten([1,2],3) == [1,2,3]))
assert(all(arrayflatten([1;2;3],4) == [1,2,3,4]))
assert(all(arrayflatten([1,2;3,4]',5) == [1,2,3,4,5]))
Function File: C = cellflatten ( X, … )

Flatten the arguments X, … into one cell vector C.

Examples

assert(all(cellfun(@eq, cellflatten({}), {})))
assert(all(cellfun(@eq, cellflatten({1}), {1})))
assert(all(cellfun(@eq, cellflatten({1,2}), {1,2})))
assert(all(cellfun(@eq, cellflatten({1,2},3), {1,2,3})))
assert(all(cellfun(@eq, cellflatten({{1},{2},3},4), {1,2,3,4})))
assert(all(cellfun(@eq, cellflatten({{1,2},{3,4},5}), {1,2,3,4,5})))
Function File: x = replOver ( x, dims, siz )

Replicate x over dimensions dims, so that its final size is siz.

Examples

assert(replOver([1,2,3], 1, [3,3]), [1, 2, 3; 1, 2, 3; 1, 2, 3])
assert(replOver([1,2,3], 2, [3,3]), [1, 1, 1; 2, 2, 2; 3, 3, 3])