Navigation

Operators and Keywords

Function List:

C++ API

: [err, yi, …] = common_size (xi, …)

Determine if all input arguments are either scalar or of common size.

If true, err is zero, and yi is a matrix of the common size with all entries equal to xi if this is a scalar or xi otherwise. If the inputs cannot be brought to a common size, err is 1, and yi is xi. For example:

[err, a, b] = common_size ([1 2; 3 4], 5)
     ⇒ err = 0
     ⇒ a = [ 1, 2; 3, 4 ]
     ⇒ b = [ 5, 5; 5, 5 ]

This is useful for implementing functions where arguments can either be scalars or of common size.

See also: size, size_equal, numel, ndims.

Package: octave