SetStructureField

PURPOSE ^

SETSTRUCTUREFIELD - set structure field

SYNOPSIS ^

function array=SetStructureField(array,name,field,value);

DESCRIPTION ^

SETSTRUCTUREFIELD - set structure field

   Go through the elements of an array and a a given value
   for a given field

   Usage:
      array=SetStructureField(array,name,field,value)

   See Also: MODELPROCESSOR

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function array=SetStructureField(array,name,field,value);
0002 %SETSTRUCTUREFIELD - set structure field
0003 %
0004 %   Go through the elements of an array and a a given value
0005 %   for a given field
0006 %
0007 %   Usage:
0008 %      array=SetStructureField(array,name,field,value)
0009 %
0010 %   See Also: MODELPROCESSOR
0011 
0012 if (ischar(value)  | isscalar(value)),
0013     for n=1:length(array), 
0014         structure=getfield(array(n),name);
0015         structure=setfield(structure,field,value);
0016         array(n)=setfield(array(n),name,structure);
0017         %array(n).element=SetField(array(n).element,field,value);
0018     end
0019 else
0020     for n=1:length(array), 
0021         structure=getfield(array(n),name);
0022         structure=setfield(structure,field,value(n,:)');
0023         array(n)=setfield(array(n),name,structure);
0024         %array(n).element=SetField(array(n).element,field,value(n,:));
0025     end
0026 end

Generated on Sun 29-Mar-2009 20:22:55 by m2html © 2003