LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to read a certain range from binary file

Dear all LabView experts!

I've attempted to acquire data as fast as I can from TDS 2024 via GPIB interface. The data will be saved into one binary file and be used for later analysis.
The program that is included here will perform continuous acquiring and save all the points into 1 file.
I used WHILE loop to do this job and each loop will take 2500 points from the scope.
After that, I would like to read the file such that every 2500 points will be read out and analyzed.
can you please show me how to do this?
I've acknowleged that 2 inputs: pos. mod and pos.offset should be able to provide random access to the binary at any point. However, I cannot have this done
THank you very much

0 Kudos
Message 1 of 13
(4,091 Views)

Hi CSUEB,

      Perhaps this will work for you - or give you some ideas.  I got rid of the stacked-sequence (they're generally discouraged here) and added a loop to provide ability to review multiple plots.  Couldn't run it without the scope, but the changes are pretty straight-forward.  Please reply if it doesn't work or if you have any questions. Smiley Happy

"Inside every large program is a small program struggling to get out." (attributed to Tony Hoare)
0 Kudos
Message 2 of 13
(4,075 Views)

Thanks millions

I have labview 6 not 7.1. I would try to install labview 7 within 3 days.

One more point: I would to like access binary file, say, reading out first 2500 points, reading out next 2500 points ....

I've read the HELP section and realized that pos. mode and pos.offset could be able to perform this task. Can you please show me how to do that?

Thanks so much

0 Kudos
Message 3 of 13
(4,061 Views)

... one more try (in 6i)...

Again, pls let me know if it doesn't work. Smiley Happy

 

"Inside every large program is a small program struggling to get out." (attributed to Tony Hoare)
0 Kudos
Message 4 of 13
(4,053 Views)
first of all, thanks million for your neat program
however, the reading-file part failed! I got error #4 from module READ-FILE. I don't understand the "PLOT INDEX".
My idea is that, the program has been able to continuously acquire data from the scope. The missing module (you left a question mark) was replaced by my driver for TDS 2024; it will get 2500 points each runs. The file will contain 2500 x numer_of_iteration points. I would like to read every 2500 points within the file. Does the PLOT INDEX mean the number of set (the set will contain 2500 points).?
 
thanks alot for you help
PS: here is the driver
0 Kudos
Message 5 of 13
(4,033 Views)
there is another point. When I set the PLOT INDEX to be 0, the program was able to read the entire file! (on the graph, it showed multiple plots overlapping each others). I'm sorry if I did not explain so well. The idea is that:
1. The bin file contains multiple plots (each plot will be consisting of 2500 points taken from the TDS scope).
2. I'd like o use some sort of WHILE loop to read each plot and feed it into another VI that will analyze the data. In order to do that, I used pos.mode and pos.offset to access the fine at any range I want. For example, first plot will be from 0 to 2500, second will be 2501 to 5000 so on and so forth. But I couldn't use the right values of pos.mode and pos.offset to achieve it.
 
When I change PLOT INDEX to be 1 (any values that's greater than 0), I got ERROR #4 from the module READ FILE
 
Can you please check it?
 
Thanks alot
0 Kudos
Message 6 of 13
(4,031 Views)
Again, sorry for mistyping.
1. If I set PLOT INDEX = 0, the first iretation return no error. But from the second iteration, it returns error 4
2. If I set PLOT INDEX = 1 (anything greater than 0), the error is 4
0 Kudos
Message 7 of 13
(4,026 Views)
this is my BIN file
0 Kudos
Message 8 of 13
(4,026 Views)

Hi CSUEB,

      Thanks for your patience - and for the sample data. Smiley Happy

Here's a Reader VI that will work (as long as the byte-stream type length is 20004 elements.) Smiley Wink

Cheers!

"Inside every large program is a small program struggling to get out." (attributed to Tony Hoare)
0 Kudos
Message 9 of 13
(4,014 Views)
I have to say thanks million for you help!
By the way, just others concept questions:
1. How did you get the number 20004?
2. YOu set the time to be 333 ms. What does this do? Is it making the iteration be executed every 333 ms?

thank you so much
0 Kudos
Message 10 of 13
(3,980 Views)