08-14-2020 01:18 AM
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.
08-14-2020 01:40 AM
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…
08-14-2020 03:12 AM
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.