recover_input

PURPOSE ^

RECOVER_INPUT - recover the field of a structure

SYNOPSIS ^

function [field,fieldispresent]=recover_input(inputs,fieldname)

DESCRIPTION ^

RECOVER_INPUT - recover the field of a structure

   From a certain structure, recover the field that corresponds to a certain 
   field name. For example: field=recover_input(input,'bof') where input=struct('bof',4,'baf',5)
   will return the value 4, and 1 for fieldispresent. If 'bof' field did not exist, field would be 
   NaN and fieldispresent would be 0.

   Usage:
      [field,fieldispresent]=recover_input(inputs,fieldname)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function  [field,fieldispresent]=recover_input(inputs,fieldname)
0002 %RECOVER_INPUT - recover the field of a structure
0003 %
0004 %   From a certain structure, recover the field that corresponds to a certain
0005 %   field name. For example: field=recover_input(input,'bof') where input=struct('bof',4,'baf',5)
0006 %   will return the value 4, and 1 for fieldispresent. If 'bof' field did not exist, field would be
0007 %   NaN and fieldispresent would be 0.
0008 %
0009 %   Usage:
0010 %      [field,fieldispresent]=recover_input(inputs,fieldname)
0011 
0012 if  isfield(inputs,fieldname),
0013     field=getfield(inputs,fieldname);
0014     if ~isempty(field),
0015         fieldispresent=1;
0016     else
0017         fieldispresent=0;
0018     end
0019 else
0020     field=NaN;
0021     fieldispresent=0;
0022 end

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