LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to write file save time and experimental conditions in a binary file

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.

 

1.png

0 Kudos
Message 1 of 5
(479 Views)

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…

Best regards,
GerdW


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

@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.)

0 Kudos
Message 3 of 5
(437 Views)

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!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 5
(429 Views)

@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,

0 Kudos
Message 5 of 5
(371 Views)