LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Want to read binary files in specified parts from 500th row to 5000th row.

Solved!
Go to solution

I have binary data file of 200 MB of 1000561 rows and 32 columns when i am reading file and sequentially ploting memory full  message generated.

 

Now I want to read file in parts like from 500th row to 5000th row with all column and plot it in the graph.

 

I tried to design logic using advanced file functions like set file position and read binary file block but still dont get the sollution.

 

Please help me out to solve this issue.

 

Thanks in advance..

0 Kudos
Message 1 of 7
(3,282 Views)

You have to know the format of the binary data before you can extract it.  It's like having the decoder ring.  What made this file?

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 2 of 7
(3,269 Views)

Thanks for your quick reply..

 

Data stored in the form of string..

 

0 Kudos
Message 3 of 7
(3,242 Views)

Actually this is my data coming from 32 AI channels at 1 ks/s samling rate so it is 1000 Seconds data of all channels.

 

As I am trying to read from read binary file and plot in graph by indexing  labview showing Memory full error.

 

Now I want to provide user control to select duration to analyse in duration like from 50th sec to 150 sec.

 

So I want to read file in parts and plot it parallely in graph for analysis according to duration selected by user.

 

I want maximum analysis duaration of 100 sec.

 

Waiting for your reply...

 

thanks

0 Kudos
Message 4 of 7
(3,233 Views)

Probably the simplest thing to do is make a cluster of what you consider to be one "packet" of data.  You write those packets using the "Write to Binary File."  You retrieve the data using the "Read from Binary File" using the same cluster.  Using that cluster tells LabVIEW how the data coming out should be interpreted.  Of course, if you use the wrong cluster, the data is not interpreted correcly and you end up with gibberish.

 

Maybe your best format is an array of clusters.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 5 of 7
(3,221 Views)

ospl wrote:

Data stored in the form of string..


Then this isn't really a binary file!

 

Can you provide an example section of the data file, along with a VI that shows what you've tried? There  might be an easy fix to the memory problems, but there's no way to know without seeing your code.

 

If every data point within a particular column is stored in the same number of characters (so if you have a column that contains 5 and 50, you would need the values stored as something like "05.5" and "50.0" so that they both occupy 4 bytes) then it is easy to skip to a particular row. If you were really using a binary file, such that you were storing the numbers in their computer representation rather than as text, it would also be easy to skip to a particular row.

 

However, if you're using a string representation, then most likely each number is stored using as many characters (bytes) as is required to display the value, so there's no consistency. In this case, there's no quick way to skip the to the correct location in the file. If you can fit all the data in memory as numbers, then the best solution is probably to read in the entire file, convert to numeric, and display the appropriate section of the array.

0 Kudos
Message 6 of 7
(3,211 Views)
Solution
Accepted by topic author ospl

Hi ospl,

 

To read specific part of binary file I suggest you to set the file position from where you want to read data and specify how many block you need to read from binary file into read binary file.VI 

 

for example if you write 2D array into binary file then mention you data type this 2D array and make your count (5000-500). Then set you file position. If you have 32 column and data type DBL then it makes 256 for second row and 256*500 for 501th row. Use this number as input to your get file position.vi.

 

 

 

I hope you will find you way through this. 

CLAD
Passionate for LabVIEW
Message 7 of 7
(3,171 Views)