0001 function savestruct(varargin)
0002
0003
0004
0005
0006
0007
0008 if nargin ~= 2
0009 error('Need matfile name and structure (only)');
0010 end
0011 if isstruct(varargin{1}), varargin = varargin([2 1]); end
0012 varargin{3} = fieldnames(varargin{2});
0013 if any(ismember(varargin{3}, {'wombat_tongue'}))
0014 error('Whoops, unexpected use of wombat_tongue');
0015 end
0016 for wombat_tongue = 1:length(varargin{3})
0017 eval([varargin{3}{wombat_tongue} ' = varargin{2}.' varargin{3}{wombat_tongue} ...
0018 ';']);
0019 end
0020 save(varargin{1}, varargin{3}{:});
0021 return