% STRUCT2OBJ converts the input structure into the given object.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% DESCRIPTION: STRUCT2OBJ converts the input structure into the given object.
%
% CALL:        obj  = struct2obj(s, class)
%
% INPUTS:      s     - the structure to convert
%              class - the class of the object to convert to
%
%
% OUTPUTS:     obj - the converted object
%
% VERSION:     $Id: struct2obj.m,v 1.2 2008/07/03 18:20:25 ingo Exp $
%
% HISTORY: 09-05-07 M Hewitson
%             Creation
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function varargout = struct2obj(varargin)

% Get inputs
if isstruct(varargin{1})
  s = varargin{1};
else
  error('### Incorrect usage. The first argument should be a structure.');
end
if ischar(varargin{2})
  cl = varargin{2};
else
  error('### Incorrect usage. The second argument should be a class name (string).');
end

% Make an empty object
eobj = eval(cl);
% Get the specification of the required type
fnames = fieldnames(eobj);

% Loop over fields and try to set them from the structure


% Set output
varargout{1} = [];