Is there a Matlab conditional IF operator that can be placed INLINE like VBA's IIF

后端 未结 10 1296
滥情空心
滥情空心 2020-12-01 11:06

In VBA I can do the following:

A = B + IIF(C>0, C, 0)

so that if C>0 I get A=B+C and C<=0 I get A=B

10条回答
  •  Happy的楠姐
    2020-12-01 11:21

    Using:

    eval('input;', 'input = 1;');

    is very helpful where 'input' might not exist in the first place.

提交回复
热议问题