is there a way of typing for if like:
var = (cond) ? true : false;
or do we have to use this format?
if (cond) true else
If you only need true or false, you can do what MatlabSorter suggests. In case you want a real tertiary operator (i.e. a = b ? c : d), there is none in MATLAB. However, using the file supplied here, you can get close.
MatlabSorter
a = b ? c : d