Igor does not recognize decimal numbers from my data?!?

Hi all,

I am quite new to Igor and work at the moment on a procedure to first extract the important data from a longer list (which works fine so far) and then in a second step use x, y, and z coordinates to calculate the angle between two planesspanned by three points from the data lisz.
The input data has the format as shown here exemplarily for one line:

ATOM 1 N LYS A 4 -9.695 26.582 2.543 1 20.62 N

As you can see it is a mixture of numbers and strings, seperated by tabs, of which I load each in a seperate wave.

My problem is, that I cannot manage to use the decimal x,y,z-coordinates for further calculations, because Igor does not identifies them as numbers, irrespective of loading the data as text oder numeric wave.
I also tried to use the "str2num" command, but this always gives me a "NaN" answer.

Do you have any suggestions how I can either load the original data or modify the waves in a way to be able to use the coordinates in a mathematical transformation?

Thanks a lot!
Quote:
As you can see it is a mixture of numbers and strings, seperated by tabs, of which I load each in a seperate wave.


If you are attempting to load this data from a file using the LoadWave operation, you need to use "Load Delimited Text", and you need to specify space as a delimiter character. For details, execute:
DisplayHelpTopic "Loading Delimited Text Files"

hrodstein wrote:
Quote:
As you can see it is a mixture of numbers and strings, seperated by tabs, of which I load each in a seperate wave.


If you are attempting to load this data from a file using the LoadWave operation, you need to use "Load Delimited Text", and you need to specify space as a delimiter character. For details, execute:
DisplayHelpTopic "Loading Delimited Text Files"


Hello hrodstein,

thanks for your reply. I load the data via "Load delimited text" and end up with each column in a seperate wave, as planned. I can also work with the waves containing strings, for example to delete lines in all 11 waves that contain data I am not interested in.
The problem starts when I want wo calculate using the x,y,z coordinates (entries 7-9 in the data example), because Igor does not recognizes them as numbers and I also cannot transfer them to numbers via "str2num". I also tried to load only those waves with the coordinates seperately as numerical waves, but the result is the same.
I originally thought your file used space as delimiter but I reread your post and see this:
Quote:

seperated by tabs


When you use "Load Delimited Text", Igor should load the numbers into numeric waves. You can check if waves are numeric or text using Data->Browse Waves. If waves that should be numeric are text instead then something went wrong.

If your file really is tab-delimited, "Load Delimited Text" should load the numbers in the file as numeric waves. I recommend that you try this in a new experiment so as to avoid confusion caused by waves that you have already loaded.

You should use Data->Load Waves->Load Waves and choose Delimited Text from the popup menu. Don't use Data->Load Waves->Load Delimited Text as this is a shortcut that does not provide all options.

If you are still does not able to get Igor to load the numbers as numeric waves, zip your data file or a representative section of it starting from the beginning and including any header lines plus some data lines. Post the zip file here. And specify the exact LoadWaves command that you are using and what kind of waves are created as indicated in the Browse Waves dialog.
I reloaded the data as you suggested and indeed, the waves are loaded correctely either as text or numbers. I can also access distict elements of the coordinates directly cia the command window and print them.
If I implement for exmaple "print xcoord[1]" or "print xoord_l[1]" into my procedure, it either gives me an error (1. case) or replies nothing (2. case): But at least I know now, that I maybe didn´t define the waves within the procedure in the proper way and that the problem is not due to the data(format) in the waves, so I can now work on this in more detail.

EDIT: Found my mistake, defined it as text wave in the function. Thanks again for your fast help.
I recognize the type of file you are reading as a Protein Data Bank file. It's not really a delimited format, it's column-specific. If you try to read various PDB files as delimited, the number of spaces between columns varies, and it probably won't work well.

Fortunately, Igor can read this type of file as well, but it takes a bit more work. Below is a sort of fast and loose procedure for reading PDB files - it doesn't really read all the columns, but shows basically how to do it. I'm not doing anything with the PDB header info, I take that out in a text editor.

Function ReadPDBFile()
   
    String columnInfo = ""          // This only works for rows starting with "ATOM"
    columnInfo+="C=1,W=6,N=keyword;"    //"ATOM" name column
    columnInfo+="C=1,W=6,N='_skip_';"   // Atom number (last column unspecified)
    columnInfo+="C=1,W=5,N='_skip_';"   // Atom name; last character is "alt Loc"
    columnInfo+="C=1,W=3,N='_skip_';"   // Residue name; starts at column 18
    columnInfo+="C=1,W=2,N='_skip_';"   // Chain identifier in column 22 (21=?)
    columnInfo+="C=1,W=4,N='_skip_';"   // Residue sequence number
    columnInfo+="C=1,W=4,N='_skip_';"   // Blank stuff
    columnInfo+="C=1,W=8,N=xval;"          // Should start at column 31
    columnInfo+="C=1,W=8,N=yval;"
    columnInfo+="C=1,W=8,N=zval;"
    columnInfo+="C=1,W=6,N='_skip_';"   // Occupancy
    columnInfo+="C=1,W=6,N='_skip_';"   // Temperature info
    columnInfo+="C=1,W=11,N='_skip_';"  // Element symbol   (col 77,78)
    columnInfo+="C=1,W=2,N='_skip_';"   // Charge (col 79,80)
   
    LoadWave/A/O/F={14,8,0}/K=0/B=columnInfo
    Wave xval, yval, zval
    Wave/T keyword
    Variable count=numpnts(keyword)-1
    do
        if (strsearch(keyword[count], "ATOM", 0) <0 )
            DeletePoints count, 1, keyword, xval, yval, zval
        endif
        count-=1
    while (count >= 0 )
    KillWaves keyword
End