function y=myround(x,n)

% MYROUND(X,N) rounds number X to N significant figures
%              N defaults to 2

if nargin < 2, n = 2; end

%y=str2num(num2str(x,n));

if x<0
  n = ceil( log10(-x) ) - n;
  y = -round( -x ./ (10.^n) );
  y = y .* 10.^n;
elseif x==0
  y=0;
else
  n = ceil( log10(x) ) - n;
  y = round( x ./ (10.^n) );
  y = y .* 10.^n;
end
