structtomodel

PURPOSE ^

STRUCTTOMODEL - convert a structure into a model

SYNOPSIS ^

function md=structtomodel(md,structmd)

DESCRIPTION ^

STRUCTTOMODEL - convert a structure into a model

   This function will take all the fields in structmd and copy them to corresponding
   fields in the md @model class instance. If the field does not exist in md, it is dropped.

   Usage:
      md=structtomodel(md,structmd)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function md=structtomodel(md,structmd)
0002 %STRUCTTOMODEL - convert a structure into a model
0003 %
0004 %   This function will take all the fields in structmd and copy them to corresponding
0005 %   fields in the md @model class instance. If the field does not exist in md, it is dropped.
0006 %
0007 %   Usage:
0008 %      md=structtomodel(md,structmd)
0009 
0010 structfields=fields(structmd);
0011 for i=1:length(structfields),
0012     field=structfields(i);field=field{1};
0013     fieldval=getfield(structmd,field);
0014     if isfield(struct(md),field),
0015         md=setfield(md,field,fieldval);
0016     end
0017 end

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