LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

get a specific cluster out of a datalog file

HI!
I'm saving a cluster with controls (boolean, dbl, u32...) into a datalog file. For several different settings of the controls I'm saving the clusters consecutively in to the file. Is there a way to directly access a certain position at the file, in order to instantly read this position without going thru the hole file with a while loop? If I want to replace a certain position with a changed cluster is there a way to do it directly?
0 Kudos
Message 1 of 5
(2,895 Views)
Random access for reading is very easy to do, simply wire up the position terminal on the Read VI. Random access for writing is unfortunately not so simple. LabVIEW won't do it for you, and while you might be able to figure it out with a lot of file manipulation (using binary access to the file rather than datalog) it would be a really big pain. If you are looking to do these types of things then you might be better off using a more robust file storage method such as the Storage VIs (7.1 only).

Regards,
Ryan K.
0 Kudos
Message 2 of 5
(2,895 Views)
If I have a datalog file (cluster connected to the datalog type input) LV won't allow me to connect anything to the position input as the file reference is of datalog type. So that is not working as well.
I'will have to stick to LV 6.1 although I have the 7.1 version but it is not used at our site up to now (driver problems). So this is not possible. Would it be easier to store an array of clusters and only read or write the array to or from the file and then do all the manipulation in the array?
0 Kudos
Message 3 of 5
(2,895 Views)
If you are talking about Read File, LabVIEW will allow you to wire the pos offset terminal (I'm doing it right now in LV 6.1 with the Read Datalog File Example), it should only stop you if you are doing a file write. You could certainly write and read an entire array to a file, but it wouldn't really gain you anything, if you are going to write the entire file at a time rather than updating a certain record, then you may as well just use datalog files and overwrite the file.

Regards,
Ryan K.
0 Kudos
Message 4 of 5
(2,895 Views)
Right now I think I'm doing exactly what you assumed to do. I just read and write the entire array with datalogfiles and overwrite existing files. After reading I manipulate the array, (what is very easy) the way I want to and just overwrite the same file with the altered array. That seems to work fine so far for me...
Thanks for your support.
0 Kudos
Message 5 of 5
(2,895 Views)