Home > functions > gui > bm_editor > state > state_new.m

state_new

PURPOSE ^

create state object

SYNOPSIS ^

function [obj] = state_new(state, description)

DESCRIPTION ^

 create state object
 [USAGE]
    [obj] = state_new(<status>[, description]);
 [IN]
          state : state value.
    description : <<string>> status explanation.

    e.g. obj = state_new(ON, 'Switch is ON');

 [OUT]
    obj : state object

 Copyright (C) 2011, ATR All Rights Reserved.
 License : New BSD License(see VBMEG_LICENSE.txt)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [obj] = state_new(state, description)
0002 % create state object
0003 % [USAGE]
0004 %    [obj] = state_new(<status>[, description]);
0005 % [IN]
0006 %          state : state value.
0007 %    description : <<string>> status explanation.
0008 %
0009 %    e.g. obj = state_new(ON, 'Switch is ON');
0010 %
0011 % [OUT]
0012 %    obj : state object
0013 %
0014 % Copyright (C) 2011, ATR All Rights Reserved.
0015 % License : New BSD License(see VBMEG_LICENSE.txt)
0016 
0017 % set class type
0018 obj.class_type = 'state_new';
0019 
0020 %
0021 % --- Previous check
0022 %
0023 if ~exist('state', 'var'), error('state is a required parameter.'); end
0024 if ~exist('description', 'var')
0025     description = [];
0026 end
0027 
0028 
0029 %
0030 % --- Main Procedure
0031 %
0032 obj.state = [];
0033 obj.description = [];
0034 obj = state_set_state(obj, state, description);
0035 
0036 %
0037 % --- After check
0038 %
0039 if nargout ~= 1
0040     error('function caller should receive obj.');
0041 end

Generated on Tue 27-Aug-2013 11:46:04 by m2html © 2005