Home > GLMdenoise > utilities > choose.m

choose

PURPOSE ^

function f = choose(flag,yes,no)

SYNOPSIS ^

function f = choose(flag,yes,no)

DESCRIPTION ^

 function f = choose(flag,yes,no)

 <flag> is a truth value (0 or 1)
 <yes> is something
 <no> is something

 if <flag>, return <yes>.  otherwise, return <no>.

 example:
 isequal(cellfun(@(x) choose(isempty(x),2,x),{[] 1}),[2 1])

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function f = choose(flag,yes,no)
0002 
0003 % function f = choose(flag,yes,no)
0004 %
0005 % <flag> is a truth value (0 or 1)
0006 % <yes> is something
0007 % <no> is something
0008 %
0009 % if <flag>, return <yes>.  otherwise, return <no>.
0010 %
0011 % example:
0012 % isequal(cellfun(@(x) choose(isempty(x),2,x),{[] 1}),[2 1])
0013 
0014 if flag
0015   f = yes;
0016 else
0017   f = no;
0018 end

Generated on Fri 01-Aug-2014 12:03:17 by m2html © 2005