table formatting scientific / engineering
kangaroo
Is it possible to prescribe a fixed exponent that should be used for displaying numbers in a column of a table in scientific formatting?
As an example:
wave test
test = {9.2E-12,3.7E-13,4.8E-14}
edit test
test = {9.2E-12,3.7E-13,4.8E-14}
edit test
this yields a table that says
9.2e-12
3.7e-13
4.8e-14
There's nothing wrong with that, but to make it easier to read (the real number set is a bit more complicate) I would like to have all numbers displayed with the same exponential exponent, i.e. for the simple example:
9.2e-12
0.37e-12
0.048e-12
or as
9.200e-12
0.370e-12
0.048e-12
Can Igor do this?
variable num, expp
String Sout
sprintf Sout, "%5.3fe%+g", num/10^expp, expp
return Sout
end
function test(numwave, expp) // convert numerical wave to formatted text wave
wave numwave
variable expp
make/O/T/N=(numpnts(numwave)) $("S_"+NameOfWave(numwave))
WAVE/T Slocal = $("S_"+NameOfWave(numwave))
Slocal = Snum(numwave, expp)
end
•test(wtest,-12)
October 20, 2010 at 08:18 am - Permalink
I am still hoping that there's an even simpler solution that can be applied when only quickly looking at data. Dump the numbers into a string and have a text wave is possible and does the job, but is in my view a rather complicate way of doing it.
October 20, 2010 at 10:42 am - Permalink
How about applying a factor dynamically to the data? Off the top of my head, something like ...
duplicate testwave showwave
k0 = 1
showwave := testwave*k0
edit showwave
k0 = 1e12
k0 = 1
With a bit of effort, you could likely create a function and/or control panel to do this.
HTH
--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville
October 20, 2010 at 12:18 pm - Permalink
October 25, 2010 at 01:25 am - Permalink
See the code snippet here for an example.
--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville
October 25, 2010 at 01:05 pm - Permalink