function out=setvalues
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Returns the following code as a string
%
% if ~(exist('varargin')==1);         %Should one remove the function
%                                     %declaration, to easily acces
%                                     %internal variables, this is needed
%     for i=1:size(default,1)
%	 eval([default{i,1} '=' 'default{i,2}' ';'])
%     end
% else
%     opt=rjxoptions(default,varargin);
%     for i=1:size(default,1)
%	 eval([default{i,1} '=' 'opt{i}' ';'])
%    end
% end
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Writing eval(setvalues) efter creating a cell of the form
%
% default={'Property1',value1;
%          'Property2',value2;...}
%
% replaces the default values with those specified in varargin

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

out=[...
    'if ~(exist(''varargin'')==1);'...
    'for i=1:size(default,1);'...
	'eval([default{i,1} ''='' ''default{i,2}'' '';'']);'...
    'end;'...
'else;'...
    'opt=rjxoptions(default,varargin);'...
    'for i=1:size(default,1);'...
	'eval([default{i,1} ''='' ''opt{i}'' '';'']);'...
    'end;'...
'end;'];





