LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

binary file

Dear All,

 

I am using binary file which contains 2,50,000 rows and each row is having maximum 100 characters. Now i want to read

single single row at a time after every 100 ms and delete the same row which got read.

 

Let us consider my binary file is having 2,50,000 rows and i read 1,00,000 rows from file. Finally the file should contains 1,50,000 rows .

 

Please suggest me the best method for this.

 

Thanks in advance.

 

 

0 Kudos
Message 1 of 9
(3,329 Views)

Hi mom,

 

read the whole file, remove any lines you want from your data and save back the remaining data to the file (using option "replace or create" on FileOpen)...

Best regards,
GerdW


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

Dear sir,

 

     i want to delete a single row element in file online but i don't want to open close the file as my process is very fast so please suggest me best file type or best method using LV2G.

0 Kudos
Message 3 of 9
(3,255 Views)

Hi mom,

 

please explain the terms "single row element", "file online" and "LV2G"...

Best regards,
GerdW


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

Dear sir,

 

Please find attachment

0 Kudos
Message 5 of 9
(3,242 Views)

Hi mom,

 

I would suggest a database for your approach. Here you can add and remove entries (data elements) at random order.

 

Using (text) files for your kind of task is quite a mess as files are continuous streams of bytes on the harddisc. Adding new data at the end is easy, removing bytes from the beginning of the file is a hassle (requires rewriting of all the remaining content). When your entries are of constant length you could work with two files, one for data and the other for an index into the data, but this is nearly the same as using a full-blown database...

Best regards,
GerdW


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

Can i use shift register and delete element from it?

0 Kudos
Message 7 of 9
(3,232 Views)

Hi mom,

Do you want to say taking all the values from file in an array and using delete from array for it?

If it is so the answer is no.

0 Kudos
Message 8 of 9
(3,225 Views)

You will not be able to do what you want to do with a simple binary/text file.  Your timing is too tight.  Take the simple example of removing the initial line from the file.  This is actually the worst case.  It requires you to rewrite all data but the first line back into the file, which takes a lot of time.  However, if you have control over the file format, you have much better options.  You need an indexed binary file.  A database (e.g. mySQL or PostgreSQL) has already been mentioned.  Other options are TDMS or HDF5.  You will need to use the Advanced API to delete data from a TDMS file.

 

Good luck.  Let us know if you need more info.

0 Kudos
Message 9 of 9
(3,208 Views)