05-20-2025 11:52 PM
I am trying to save 3 rows and 65536 columns of data in a binary file, where the first row is y, the second row is x, and the third row is z data.
We want to shift the data and save the second row as y, the third row as x, and the fourth row as z. Furthermore, how can I write the date and time of storage and the experimental conditions (x amp, y amp, xy freq) in the first line?
The program and a picture of the relevant part are attached.
05-21-2025 12:34 AM - edited 05-21-2025 12:40 AM
Hi ikeda,
@ikeda_kaoru wrote:
Furthermore, how can I write the date and time of storage and the experimental conditions (x amp, y amp, xy freq) in the first line?
There are no "lines" or "rows" in a binary file (aka bytestream)!
In a "binary" file you NEED TO define the file format so you can parse the file content later on. Just writing one byte after the other will lead into doom…
That being said: you can place your additional data (like amps & frequencies) in the "first row"!
As a learning resource about "rather good" definitions of file formats you can read this Wikipedia about PNG images. You can store nearly anything in PNG files besides the pure image data!
As you program in LabVIEW you should also take a look at the TDMS file format and all those TDMS file functions. Here you can add any additional information as property of channels or channel groups…
05-21-2025 03:54 AM
@GerdW さんは書きました:
Hi ikeda,
@ikeda_kaoru wrote:
Furthermore, how can I write the date and time of storage and the experimental conditions (x amp, y amp, xy freq) in the first line?
There are no "lines" or "rows" in a binary file (aka bytestream)!
In a "binary" file you NEED TO define the file format so you can parse the file content later on. Just writing one byte after the other will lead into doom…
That being said: you can place your additional data (like amps & frequencies) in the "first row"!
As a learning resource about "rather good" definitions of file formats you can read this Wikipedia about PNG images. You can store nearly anything in PNG files besides the pure image data!
As you program in LabVIEW you should also take a look at the TDMS file format and all those TDMS file functions. Here you can add any additional information as property of channels or channel groups…
My perception of binary files was wrong. Thanks for the advice.
As for the TDSM file, I will not use it. (I looked into it and thought that it would contain metadata and increase the file size.)
05-21-2025 04:36 AM
Hi ikeda,
@ikeda_kaoru wrote:
My perception of binary files was wrong. Thanks for the advice.
I hope I could correct/improve your perception…
@ikeda_kaoru wrote:As for the TDSM file, I will not use it. (I looked into it and thought that it would contain metadata and increase the file size.)
Any file formatting will add "metadata" (in the sense of "formatting information") and so will increase filesize!
Right now you want to prepend a whole row of array elements to your binary file to store your own additional data, this will increase filesize too.
TDMS helps you with those additional data as it provides a well-defined file format and lots of functions to handle such files in LabVIEW!
05-21-2025 10:01 PM
@GerdW さんは書きました:
Hi ikeda,
@ikeda_kaoru wrote:
My perception of binary files was wrong. Thanks for the advice.I hope I could correct/improve your perception…
@ikeda_kaoru wrote:As for the TDSM file, I will not use it. (I looked into it and thought that it would contain metadata and increase the file size.)
Any file formatting will add "metadata" (in the sense of "formatting information") and so will increase filesize!
Right now you want to prepend a whole row of array elements to your binary file to store your own additional data, this will increase filesize too.
TDMS helps you with those additional data as it provides a well-defined file format and lots of functions to handle such files in LabVIEW!
Thanks for the advice.
If the resulting file size increases, I would like to consider using the TDMS function.
For the time being, I would like to investigate TDMS.
Best regards,