LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Questions about Write to Binary File Function

I am trying to make some test programs.


One of them is to use the Write to Binary File Function to save 1-D data as shown below.


[1,1,1,1,2,2,2,2,3,3,3,3,1,1,1,1,2,2,2,2,3,3,3,3,3 ......]

However, after the contents of [1,1,1,1,1,1,1,1,1,1......] are first written in this file,
The contents of [1,1,1,1,2,2,2,2,1,1,1,1,2,2,2,2......] are written,
Finally [1,1,1,1,2,2,2,2,3,3,3,3,1,1,1,1,2,2,2,2,3,3,3,3 It should be written as .....].

 

The reason I try to write data this way is that the data I'm actually trying to use is much larger than that, and I can't load all of it into my RAM and process it.

 

Therefore, I want to refer to the byte index of the file and push the data after the offset.

Please comment on the above.

 

Thank you.

0 Kudos
Message 1 of 3
(870 Views)

Hi Gosan,

 


@Jaeryul-Gosan wrote:

Therefore, I want to refer to the byte index of the file and push the data after the offset.

Please comment on the above.


What have you tried and where are you stuck?

Mind to attach a VI showing your usage of the WriteBinaryFile function?

 

This function writes data at the current file position, which usually is the position (aka "byte index") after the last file operation (either read or write). You can set this file position using the SetFilePosition function if needed…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 3
(859 Views)

That should be easy enough. Do you have a fixed length of the Array or will it differ? If you look at Write binary you have a 'prepend array' which simply is an integer that says how many elements are in the Array.

So, you'll need to read the integer, then that many elements of your data type (double)? If you need to know where the next Array size is saved, it's at position (size of) data type * length.

 

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 3 of 3
(827 Views)