help mata mm_cond()
-------------------------------------------------------------------------------

Title

mm_cond() -- Matrix version of the conditional operator

Syntax

transmorphic matrix mm_cond(a, b, c)

where a is a real matrix and b and c are matrices of any type (as long as their types are the same).

Description

mm_cond() is a matrix version of the scalar conditional operator (see [M-2] op_conditional).

When a, b, and c are not scalar, mm_cond() returns element-by-element results. a, b, and c are required to be r-conformable (see [M-6] glossary).

Remarks

None.

Conformability

The arguments have to be r-conformable (see help [M-6] glossary). Returned is a matrix of max(argument rows) rows and max(argument columns) columns containing element-by-element calculated results.

Diagnostics

None.

Source code

mm_cond.mata

Author

Ben Jann, ETH Zurich, jann@soz.gess.ethz.ch

Acknowledgments

Thanks to Kit Baum for proposing such a function.

Also see