table formatting scientific / engineering

I should say first that I am not very experienced with using tables in Igor. I want to display a set of numbers in a table in scientific formatting (which I know how to do).


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


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?






If you are willing to have the wave shown as a formatted text wave for display readability, here is one possible approach
function/S Snum(num, expp)  //  convert number to formatted string
    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)
Thanks for this suggestion.

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.
kangaroo wrote:
I am still hoping that there's an even simpler solution that can be applied when only quickly looking at data. ...


How about applying a factor dynamically to the data? Off the top of my head, something like ...

make/n=4 testwave = {10e-12,1e-12, 0.2e-12, 0.02e-12}
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
Thanks JJWeimer for all the suggestions. I have never thought about creating control panels in Igor but that's an appealing idea and I will certainly pick it up.
kangaroo wrote:
.... I have never thought about creating control panels in Igor ...


See the code snippet here for an example.

--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville