LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Oops. Can I read my byte stream files with missing headers?

My fault, I know, but I wrote out an 1D array of numbers to a file using the simple Write File vi, not realising that a header would have been a good idea at the time. Now I can't read them back in because LabVIEW doesn't know what they are, and trying to put the original array element (Dbl Precision Number) on the Byte Stream Type of Read File doesn't work.

So, is there any way that I can insert an appropriate header back into the beginning of the file so that I can then read them in successfully?

(No, unfortunately I can't regenerate the data. Believe me, I would if I could!)

Thanks,

Riggy
0 Kudos
Message 1 of 3
(2,744 Views)
I suppose you used the Write File function from the File I/O pallette since there is no Write File VI?

If that is the case your file should be exactly 8*N bytes long, if the array had N elements of type DBL.

You can simply read back you data with the 'Read characters from File' VI (from the File I/O pallette) and then typecast the read string to a 1D array of DBL. (typecast is the first icon in the 'Advanced--Data Manipulation' pallette.



-Franz
Message 2 of 3
(2,737 Views)
Brilliant!
Thank you, that has worked perfectly, I would never have known to try that myself.

Most appreciated.

Riggy
(Yes, I meant Write File function, not vi)
0 Kudos
Message 3 of 3
(2,729 Views)