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

Title

mm_cond() -- Matrix version of the conditional operator

Syntax

transmorphic matrixmm_cond(a,b,c)

where

ais areal matrixandbandcare 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, andcare not scalar,mm_cond()returns element-by-element results.a,b, andcare required to be r-conformable (see[M-6] glossary).

RemarksNone.

ConformabilityThe 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.

DiagnosticsNone.

Source codemm_cond.mata

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

AcknowledgmentsThanks to Kit Baum for proposing such a function.

Also see