function save_scalars(fname, varargin)
%
%Instituto Superior Técnico - Instituto de Sistemas e Robótica - 			             09/2001
%OMNIVIEWS PROJECT    -   SVAVISCA sensor									[ccgd,jasv@isr.ist.utl.pt]
%
% function save_scalars(fname, varargin)
%
% Save to a text file a number of scalars.
% The text file will have valid m code.
%
% fname   : str  : output filename
% varargin: list : variables to save
%
% If the arguments are variables then their names
% will be saved along the scalar values.

f= fopen(fname, 'wt');

for i=1:length(varargin),
   name= inputname(i+1);
   if ~isempty(name),
      fprintf(f, '%s=', name);
   else
      fprintf(f, 'param%d=', i);
   end
   fprintf(f, ' %f', varargin{i});
   fprintf(f, ';\n');
end

fclose(f);
% 20/6/01, J. Gaspar
