function t = num2str_old(x, prec)
%NUM2STR_OLD Number to string conversion - faster matlab4 version.
%	T = NUM2STR_OLD(X) converts the scalar number X into a string
%	representation T with about 4 digits and an exponent if
%	required.  This is useful for labeling plots with the
%	TITLE, XLABEL, YLABEL, and TEXT commands.  An optional
%	argument can be supplied for indicating an alternate precision.
%	T = NUM2STR_OLD(X,PREC) converts the scalar number X into a string
%	representation with a maximum precision specified by PREC.
%
%	See also INT2STR, SPRINTF, FPRINTF.

%	Copyright (c) 1984-94 by The MathWorks, Inc.

if isstr(x)
    t = x;
else
    if (nargin == 1)
	num_format = '%.4g';
    else
	num_format = ['%.' num2str_old(prec) 'g'];
    end

    t = sprintf(num_format, real(x));
    if imag(x) > 0
       t = [t '+' sprintf(num_format, imag(x)) 'i'];
    elseif imag(x) < 0
       t = [t '-' sprintf(num_format, -imag(x)) 'i'];
    end
end
