From: Stefan v. d. W. <st...@su...> - 2005-01-15 19:53:28
|
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 What is the most common behaviour required of "text"? Regards Stefan |