LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple writes of a DBL 2D array to binary file

Solved!
Go to solution
Hello.
Does anyone have an example of writing a 2D array to a binary file multiple times?

Specifically, I need to write a 2D array of DBL to a binary file mulitple times and then (later) be able to read it back (reconvert to DBL). All of the examples that I've found only do one write and then close the file. I need to leave the file reference open and write data to it over the period of a few days. The data comes out of a queue that is fed from a DAQ loop. (In an acquistion loop I feed a queue and in a slower loop I dequeue the data and write it to disk)

I believe it has something to do with the pos mode and offset mode but I can't figure it.

I haven't been able to successfully read the data back yet from the .bin file so I'm not sure if I'm even writing it correctly.

The closest example that I've found is the High Speed Data Logger and High Speed Data Reader but I haven't had any luck with those.

Thanks in advance.
Steve
LabVIEW 7.1
0 Kudos
Message 1 of 5
(3,289 Views)
Solution
Accepted by topic author Electromecha
You shouldn't have to look any further than what's on the File I/O>Binary File VIs palette. There is a high level VI called Write to SGL file. In there are a couple of subVIs. You can use a modified version of Write File+ [SGL]. You just have to change the representation of the input arrays to DBL and save it under a new name and in a new location. Just like the high level VI does, at the beginning of your program, call Open/Create/Replace, call the new Write File whenever you need, then at the end, call the close File function. By default, I think the Write File VI will write to the end of the file.
Message 2 of 5
(3,280 Views)
Dennis-
Thanks, those were exaclty the functions that I was looking for. It took some fiddling to get the data back out in it's original format (Binary --> SGL) but it was just a matter of keeping track of the number of rows, columns, and the mark after read for each time I called the Write File+ [SGL].vi

Thanks for simplifying things for me.

Steve
0 Kudos
Message 3 of 5
(3,262 Views)
Hello Sir, I didnt understand the sentence which you said in response to this link "You just have to change the representation of the input arrays to DBL and save it under a new name and in a new location". I have tried to modify it but I am not able to change SGL to DBL. Where can I find this type of VI ?
0 Kudos
Message 4 of 5
(3,211 Views)

To change the representation of a number, use the Numeric > Conversion sub-palette.

The example below shows that the wires contain the representation info independently of the destination indicators : you can connect different types of numerics to the same wire and LabVIEW will automatically adapt to the type (the coercion dots indicate that a convertion has been done). Everything you should want to know about converting numbers is explained in the LabVIEW Help : "Conversion VIs and Functions"

Message Edited by chilly charly on 07-30-2005 10:57 AM

Chilly Charly    (aka CC)
Message 5 of 5
(3,211 Views)