Home > chronux_1_50 > spikesort > bool2onoff.m

bool2onoff

PURPOSE ^

BOOL2ONOFF Substitutes 'on' for non-zero and 'off' for zero input.

SYNOPSIS ^

function onoff = bool2onoff(bool)

DESCRIPTION ^

BOOL2ONOFF        Substitutes 'on' for non-zero and 'off' for zero input.
   ONOFF = BOOL2ONOFF(BOOL) returns the string 'on' if BOOL evaluates as
   logically true or the string 'off' otherwise. 

   BOOL2ONOFF and ONOFF2BOOL improve readability for Matlab settings
   (e.g., Handle Graphics properties) that use the strings 'on' and 'off'.

   Example:
      set(handle, 'Enable', bool2onoff(X==Y))
          is equivalent to
      if (X==Y), e = 'on';  else, e = 'off';  set(handle, 'Enable', e);

   See also ONOFF2BOOL.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function onoff = bool2onoff(bool)
0002 %BOOL2ONOFF        Substitutes 'on' for non-zero and 'off' for zero input.
0003 %   ONOFF = BOOL2ONOFF(BOOL) returns the string 'on' if BOOL evaluates as
0004 %   logically true or the string 'off' otherwise.
0005 %
0006 %   BOOL2ONOFF and ONOFF2BOOL improve readability for Matlab settings
0007 %   (e.g., Handle Graphics properties) that use the strings 'on' and 'off'.
0008 %
0009 %   Example:
0010 %      set(handle, 'Enable', bool2onoff(X==Y))
0011 %          is equivalent to
0012 %      if (X==Y), e = 'on';  else, e = 'off';  set(handle, 'Enable', e);
0013 %
0014 %   See also ONOFF2BOOL.
0015 
0016 if (bool), onoff = 'on';  else,  onoff = 'off';  end;

Generated on Mon 09-Oct-2006 00:54:52 by m2html © 2003