Fid2ascii.m

From Spinach Documentation Wiki
Jump to: navigation, search

Writes free induction decays into ASCII files in a format that old-school NMR processing packages understand.

Syntax

    fid2ascii(filename,fid)

Description

NMR data processing packages, such as NMRPipe, are expecting the input data to be ASCII files with a specific data order. The state of affairs with format standardisation is best described as rampant chaos, but we eventually came to the conclusion that most packages may be persuaded to read ASCII data in the followng format:

    [time1, time2, time3, value]

with complex data is exported as a double point count in the first dimension. First the reals, then the imaginaries. Time units are not given, only the point numbers - it is the user's reponsibility to tell his processing package what the sweep width was in each direction.

Arguments

    filename - the name of the ASCII file to be written, a character string
         fid - 1D, 2D or 3D free induction decay as a Matlab array

Returns

The function writes an ASCII file.

Examples

The following Matlab array:

    >> rand(3,3,3)+1i*rand(3,3,3)
    
    ans(:,:,1) =
    
       0.6987 + 0.0967i   0.7441 + 0.7224i   0.9047 + 0.5186i
       0.1978 + 0.8181i   0.5000 + 0.1499i   0.6099 + 0.9730i
       0.0305 + 0.8175i   0.4799 + 0.6596i   0.6177 + 0.6490i
    
    ans(:,:,2) =
    
       0.8594 + 0.8003i   0.1829 + 0.8253i   0.0287 + 0.1734i
       0.8055 + 0.4538i   0.2399 + 0.0835i   0.4899 + 0.3909i
       0.5767 + 0.4324i   0.8865 + 0.1332i   0.1679 + 0.8314i
    
    (:,:,3) =
    
       0.9787 + 0.8034i   0.4711 + 0.5269i   0.0424 + 0.6280i
       0.7127 + 0.0605i   0.0596 + 0.4168i   0.0714 + 0.2920i
       0.5005 + 0.3993i   0.6820 + 0.6569i   0.5216 + 0.4317i

is written into the following ASCII file:

    1 1 1 6.98745832E-01 
    2 1 1 1.97809827E-01 
    3 1 1 3.05409463E-02 
    4 1 1 9.67300258E-02 
    5 1 1 8.18148554E-01 
    6 1 1 8.17547092E-01 
    1 2 1 7.44074260E-01 
    2 2 1 5.00022436E-01 
    3 2 1 4.79922141E-01 
    4 2 1 7.22439592E-01 
    5 2 1 1.49865442E-01 
    6 2 1 6.59605253E-01 
    1 3 1 9.04722238E-01 
    2 3 1 6.09866648E-01 
    3 3 1 6.17666390E-01 
    4 3 1 5.18594943E-01 
    5 3 1 9.72974555E-01 
    6 3 1 6.48991493E-01 
    1 1 2 8.59442306E-01 
    2 1 2 8.05489425E-01 
    3 1 2 5.76721516E-01 
    4 1 2 8.00330575E-01 
    5 1 2 4.53797709E-01 
    6 1 2 4.32391504E-01 
    1 2 2 1.82922469E-01 
    2 2 2 2.39932011E-01 
    3 2 2 8.86511933E-01 
    4 2 2 8.25313795E-01 
    5 2 2 8.34698149E-02 
    6 2 2 1.33171008E-01 
    1 3 2 2.86741525E-02 
    2 3 2 4.89901389E-01 
    3 3 2 1.67927146E-01 
    4 3 2 1.73388613E-01 
    5 3 2 3.90937802E-01 
    6 3 2 8.31379743E-01 
    1 1 3 9.78680650E-01 
    2 1 3 7.12694472E-01 
    3 1 3 5.00471624E-01 
    4 1 3 8.03364392E-01 
    5 1 3 6.04711792E-02 
    6 1 3 3.99257771E-01 
    1 2 3 4.71088375E-01 
    2 2 3 5.96188676E-02 
    3 2 3 6.81971904E-01 
    4 2 3 5.26875831E-01 
    5 2 3 4.16799468E-01 
    6 2 3 6.56859891E-01 
    1 3 3 4.24311375E-02 
    2 3 3 7.14454646E-02 
    3 3 3 5.21649842E-01 
    4 3 3 6.27973359E-01 
    5 3 3 2.91984080E-01 
    6 3 3 4.31651170E-01

Note that the first dimension has six elements rather than three - that is how the imaginary parts are stored.

Notes

If you find a better way of exporting Matlab arrays into NMR data formats, or you are the author of one of the data processing packages and you know exactly which format you want, do email Ilya Kuprov and we'll make an output filter for you.

See also

gparse.m, oparse.m, protein.m, nuclacid.m


Revision 3284, authors: Ilya Kuprov