Home > chronux_1_50 > spikesort > onoff2bool.m

onoff2bool

PURPOSE ^

ONOFF2BOOL Substitutes 1 for 'on' and 0 for any other string.

SYNOPSIS ^

function bool = onoff2bool(onoff)

DESCRIPTION ^

ONOFF2BOOL        Substitutes 1 for 'on' and 0 for any other string.
   BOOL = ONOFF2BOOL(ONOFF) returns logical 1 if ONOFF is equal to the
   string 'on' and logical 0 otherwise.

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

   Example:
      if (onoff2bool(get(handle,'Enable'))), ...
                         is equivalent to 
      if (strcmp(get(handle, 'Enable'), 'on')), ...

   See also BOOL2ONOFF.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function bool = onoff2bool(onoff)
0002 %ONOFF2BOOL        Substitutes 1 for 'on' and 0 for any other string.
0003 %   BOOL = ONOFF2BOOL(ONOFF) returns logical 1 if ONOFF is equal to the
0004 %   string 'on' and logical 0 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 %      if (onoff2bool(get(handle,'Enable'))), ...
0011 %                         is equivalent to
0012 %      if (strcmp(get(handle, 'Enable'), 'on')), ...
0013 %
0014 %   See also BOOL2ONOFF.
0015 
0016 bool = strcmp(onoff, 'on');

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