Home > marsbar > @marmoire > set_item_param.m

set_item_param

PURPOSE ^

method to set item parameters

SYNOPSIS ^

function o = set_item_param(o, item, param, value)

DESCRIPTION ^

 method to set item parameters
 FORMAT o = set_item_param(o, item, param, value)

 o     - object
 item  - item name
 param - parameter name
 value - value to set

 Returns
 o     - object
 
 $Id$

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function o = set_item_param(o, item, param, value)
0002 % method to set item parameters
0003 % FORMAT o = set_item_param(o, item, param, value)
0004 %
0005 % o     - object
0006 % item  - item name
0007 % param - parameter name
0008 % value - value to set
0009 %
0010 % Returns
0011 % o     - object
0012 %
0013 % $Id$
0014   
0015 if nargin < 2
0016   error('Need item name');
0017 end
0018 if nargin < 3
0019   error('Need parameter name');
0020 end
0021 if nargin < 4
0022   error('Need value to set')
0023 end
0024 
0025 I = get_item_struct(o, item);
0026 
0027 fns = fieldnames(I);
0028 tmp = strmatch('data', fns, 'exact');
0029 fns(tmp) = [];
0030 
0031 if ~ismember(param, fns)
0032   error(['There is no parameter callled: ' param]);
0033 end
0034 
0035 I = setfield(I, param, value);
0036 o = set_item_struct(o, item, I);

Generated on Wed 11-May-2022 16:26:09 by m2html © 2003-2019