function f = choose(flag,yes,no) % function f = choose(flag,yes,no) % % is a truth value (0 or 1) % is something % is something % % if , return . otherwise, return . % % example: % isequal(cellfun(@(x) choose(isempty(x),2,x),{[] 1}),[2 1]) if flag f = yes; else f = no; end