Home > marsbar > @marmoire > add_if_absent.m

add_if_absent

PURPOSE ^

Adds item only if not already present

SYNOPSIS ^

function o = add_if_absent(o, item, data)

DESCRIPTION ^

 Adds item only if not already present
 
 $Id$

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function o = add_if_absent(o, item, data)
0002 % Adds item only if not already present
0003 %
0004 % $Id$
0005   
0006 if nargin < 2
0007   error('Need name of item to add');
0008 end
0009 if nargin < 3
0010   error('Need data to put into item');
0011 end
0012 if ~item_exists(o, item)
0013   o = add_item(o, item, data);
0014 end

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