LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem woth storing data in binary.

Hi,
 
I have some data which I am storing in binary and when I read it back in, I get different data than that which was stored...I was wondering if anyone could help me out as to what I have done wrong,  Below are the 2 Vi's I am using to test this: the first one makes the binary file, the second one reads it back in.  Thanks a lot for any help!
Intern NSWCCD Carderock.
0 Kudos
Message 1 of 8
(3,307 Views)
the reader...
Intern NSWCCD Carderock.
0 Kudos
Message 2 of 8
(3,303 Views)
any ideas? It is totally confusing me.. thanks.
Intern NSWCCD Carderock.
0 Kudos
Message 3 of 8
(3,280 Views)
You have DBL data that you convert to SGL for storage. There will be a loss in resolution.
If you want to store the data with full precision, you need to store (and later read) it as DBL.
0 Kudos
Message 4 of 8
(3,278 Views)
Hi,

Thanks for the reply. I was wondering is there an easy way to go about changing the labview vi "Write to SGL file" to instead write DBL to binary? Thanks a lot for the help.
Intern NSWCCD Carderock.
0 Kudos
Message 5 of 8
(3,263 Views)

Save the VI and the subVI that actually does the writing to the file with new names. Now on the top level vi right click on the 2D and 1D inputs and change the representation from SGL to DBL. Save your work.

Now open the diagram and you'll notice that the subVI that writes the data has coersion dots on its icon. Open the subvi and right click on the 2D and 1D inputs and change the representation from SGL to DBL. Save your work.

You should now be saving in Double-Precision. Make similar changes to the read VI and you're done...

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 6 of 8
(3,255 Views)

The read vi is actually a bit more complex to modify.

Modifications to "read from SGL file":

  • Replace the "4" with an "8" for the quotient&remainder division (8bytes/DBL).
  • Change the "1D array" and "2D array" output to DBL.
  • Open "Read File +[SGL]"
    • Change "to Single precision float" to "to double prescision float".
    • Change the "1D data" and "2D data" arrays to DBL.

Of course you could just use a few low level VIs instead, you probably don't need all that flexibility to read or write a plain DBL 1D array.

Message 7 of 8
(3,253 Views)
It works, thanks for the help.
Intern NSWCCD Carderock.
0 Kudos
Message 8 of 8
(3,236 Views)