import text / csv / tsv - file with coloum names containing special (prime / apostrophe) characters
Hello all,
currently I try to import some text files into Igor which contain special characters like spaces, primes or aphostrophes. Of course this is not perfect at all but is has to be done (a number of times, so renaming by hand is not an option). I saw / learned / knew, that Igor replaces all "bad chars" by "_". I guess this is due to the "command line nature" of the software. It seems that spaces are not allowed in wavenames. It is the same with apostophes since they are used to keep 2 words togehter that containing spaces (but spaces are not allowed??? )? Is there no chance to use something like "escaping the char" by using the backslash symbol? An other problem is that all "special symbols" are replaced by "_". This leads to unreadable and undistinguishable names. Any chance to control this?
An example for the file header is given below. Hope someone knows what to do ... thank you in forehand.
Axel.
##No F stat. [N] Stress stat [MPa] Lo [mm] Lm [mm] F dyn. [N] Stress_dyn [MPa] Time [sec] f [Hz] T [°C] tan delta [] F cont. [N] T2 [°C] T3 [°C] c' [N/mm] c'' [N/mm] |c*| [N/mm] E'(L0/A0) [MPa] E''(L0/A0) [MPa] |E*|(L0/A0) [MPa] E'(Corrected E) [MPa] E''(Corrected E) [MPa] |E*|(Corrected E) [MPa] E'(Lm²/L0*A0) [MPa] E''(Lm²/L0*A0) [MPa] |E*|(Lm²/L0*A0) [MPa] E'(E defined) [MPa] E''(E defined) [MPa] |E*|(E defined) [MPa] E'(Lm/A0) [MPa] E''(Lm/A0) [MPa] |E*|(Lm/A0) [MPa] Strain static [mm] Strain static [%] Strain dynamic [mm] Strain dynamic [%]
1 -99.7008 10.8927 10.0646 10.1027 50.3336 5.49913 430.607 1.00000 -99.6000 0.0132945 -0.482754 NAN NAN 2.47469e+3 32.89986 2.47491e+3 2.72116e+3 36.17655 2.72140e+3 2.72057e+3 36.16873 2.72081e+3 2.74181e+3 36.45103 2.74205e+3 2.47469e+3 32.89986 2.47491e+3 2.73146e+3 36.31353 2.73171e+3 0.03811 0.378654 0.0203375 0.202070
Sperator is alwas tabluar "\t". All other things are spaces. I know this is worse but this is what the crappy piece of machine software does ... sorry.
A couple of questions/ideas.
1. Does the header change from data file to data file? If not you may want to manually set the wave names using the/B flag on import.
2. The header looks fixed space delimited. If you read in the header as a text string you could then use the delimited values as wave names. You could loop through the string taking subsets (substrings) and use cleanupname function to get an acceptable wave name.
Andy
January 11, 2018 at 09:20 am - Permalink
For an example, see http://www.igorexchange.com/node/2403#comment-3943
For a discussion of /B, see the reference help for LoadWave, section "Specifying Characteristics of Individual Columns".
January 11, 2018 at 09:24 am - Permalink