LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to save data to any file format(lvm, csv text) for an array of 24 elements with less space

Hello everyone,

 

I have 24 elements in the build array. I am trying to save the data at 10 second (only 10th s values). After 5 min the size of the file is about 10 kB. in one night the size went  to 6 GB.

 

Is there any method to save the disk space while write to measurement file, text file or spreadsheet.

 

Thanks

0 Kudos
Message 1 of 5
(1,730 Views)

Confusing. What hinders you to save the data every 10 seconds? You seem to have written code already that saves the data. How much data you save per action isn't told. So 10 kb after 5 mins could be normal even with 10 second interval. We cannot judge.

 

But yes, there are VIs that save to spreadsheet or text file. Your code defines when and what is saved. Less space can only be achieved by compression (ZIP, RAR).

0 Kudos
Message 2 of 5
(1,712 Views)

@ironman wrote:

Hello everyone,

 

I have 24 elements in the build array. I am trying to save the data at 10 second (only 10th s values). After 5 min the size of the file is about 10 kB. in one night the size went  to 6 GB.

 

Is there any method to save the disk space while write to measurement file, text file or spreadsheet.

 

Thanks


Your description is not very clear, but it points us in the right direction... if only we had some code to look at to make that final leap of understanding 😯

 

If I understand you correctly, you have a 24 element array of data (Int? Float? String?) that you want saved to a file every 10 seconds. First, lets assume you are using a simple text file and not something silly like an Excel spreed sheet. Next, lets assume a double precision number, which is 8 bytes. 24 * 8 =   192 bytes (we can remove the array overhead because we are only writing the data to a file) but you probably have separators for the data, so double that to 384. If you are saving every 10 seconds, that is 6 times a minute, so in 5 mins you have (5 * 6=) 30 writes. 30 writes * 384bytes = 11520 bytes of data... not too far from 10kB you claim.

Now, "one night" is very broad term, but lets say you were working late on this problem and then got up early the next morning to check the results. So about 14 hours? 14h * 60m *6w/m = approx 5K writes. With 384 bytes per write, that is appox 32MB. Which is very far from your 6GB claim. So, my guess is that you are storing ALL the data and not the 10th second data like you claim... but we will never know because we cannot look at your code (the real code and not just a picture of the code).

 

To further reduce your file size, you could:

- reduce your sample rate (every 20sec)

- reduce your data size (U8?)

- use a binary file (not text)

- use a database file

 

Hope this helps.

 

---------------------------------------------
Former Certified LabVIEW Developer (CLD)
Message 3 of 5
(1,667 Views)

Hi,

 

Thank you for the explanation. I think they are mentioned as SGL(single may be). You were right, the code was saving 10 data points at 10th second not 1 as desired. Thus in 16 hrs time the memory of the file went high. Now i have modified code. This is very much less. in 48 hrs only 4 MB.

 

The code i attached here as picture. I used to I8 conversion. This conversion makes digits after decimal to 0 like 15.2235 to 15.0000. Now i made the code to execute only when the machine operates and elapsed time of 10s . So expecting less data while machine not running. 

 

ironman_0-1671436916103.png

 

0 Kudos
Message 4 of 5
(1,614 Views)

Well using the "Write to Measurement File" Express VI is horribly inefficient. You should learn how to use the low level file VIs.

 

Here's a couple tips...

  1. Use the level file VI's
  2. Open a file
  3. Use Array to Spreadsheet string to convert your measurement array to a string
  4. Write a line of measurements to your file using Write Text File vi
  5. Don't forget to close your file before you exit your program
  6. For multi day test runs create a new data file every day 
========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 5 of 5
(1,600 Views)