X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 27 Apr 2011 02:32 AM by  anon
[urgent] help on binary data reading
 2 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
27 Apr 2011 02:32 AM
    Hi guys, firstly, im very new with this language so im kinda lost. well i'm actually trying to modify a software programmed in idl. This software converts unformatted binary file into ascii type format. Now, the problem is that when a number in the binary file is too long, it will combine with the previous number which results only one number in ascii file. This is very problematic because i've created another program that reads and processes the ascii file, and this problem will cause a data shift. (1024 samples in binary file will be 1023 samples in ascii file, and i have hundreds of these samples) i include a pic to make it easier to understand: As you can see, the two highlighted numbers are combined. Whenever i try to read this data in IDL, the combined numbers will be skipped. ; field 12 Spectra = FLTARR(NbComp, NbSpect) READU, unit, Spectra IF (d EQ 1) THEN BEGIN PRINTF, output_unit, "" PRINTF, output_unit, "Block4 data" PRINTF, output_unit, "======" FOR i = 0, NbSpect-1 DO BEGIN PRINTF, output_unit, Spectra[*, i] ----> this is where i print the spectrum data into the ascii file. PRINTF, output_unit, "" ENDFOR ENDIF Now, my idea is to put more spaces between two numbers. But I don't know how to do it. Thanks in advance for any help

    Deleted User



    New Member


    Posts:
    New Member


    --
    28 Apr 2011 12:30 PM
    Hello I do not believe that is the best way (and really nice) but it will work :-) crlf = string(13b) + string(10b) for ii = 0, NbSpect - 1 do begin writeu, output_unit, string(Spectra[*, ii], format='(f18.10)') writeu, output_unit, crlf ;Carriage Return endfor Cheers, Vincent

    Deleted User



    New Member


    Posts:
    New Member


    --
    06 May 2011 05:56 AM
    thanks alot. but i found another solution. It is by copying each value, one by one using FOR loop. thanks again
    You are not authorized to post a reply.