From: Laurent M. <lau...@mo...> - 2005-01-17 08:12:30
|
On Wed, 12 Jan 2005 15:28:56 +0200 Stefan van der Walt <st...@su...> wrote: > On Fri, Dec 03, 2004 at 03:12:40AM -0600, Pascal A. Dupuis wrote: > > atstr = sprintf("%f,%f", position(1),position(2)); > > > > str = sprintf("%f", 1e-9) > > results in ... 0! > > > > The following patch seems to work for me: > > > > --------------------------------------------------- > > --- text.m.orig 2004-12-03 10:08:10.000000000 +0100 > > +++ text.m 2004-12-03 10:08:42.000000000 +0100 > > @@ -147,9 +147,9 @@ > > font = ""; > > endif > > if position(3)!=0, > > - atstr = sprintf("%f,%f,%f", position(1),position(2),position(3)); > > + atstr = sprintf("%e,%e,%e", position(1),position(2),position(3)); > > else > > - atstr = sprintf("%f,%f", position(1),position(2)); > > + atstr = sprintf("%e,%e", position(1),position(2)); > > endif > > command = sprintf('gset label "%s" at %s %s %s %s%s', > > str, units, atstr, align, rotate, font); > > ---------------------------------------------------------- > > If you do that, bigger numbers will also be printed in engineering > notation. I.e. > > octave:22> sprintf("%e\n", 1024) > ans = 1.024000e+03 May we use sprintf("%g\n", 1024) ? -- Dr. Laurent Mazet: Research Engineer /V\ Centre de Recherche de MOTOROLA Tel: +33 (0)1 69 35 48 30 =-=-=-=-=-=-=-=-=-=-= Email: ma...@cr... |