LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem in reading binary files

Hi all,

 

I am a new user to LV. I am using a high sampling rate NI Scope VI to write to a binary file. I modified it to write a 2 channel data. The gain, offset, and xincrement are prewritten to the actual data. I am facing problems in reading 2 channel data. When I give the data type as @D double to read VI. I read nothing. But when I give a 1D double, I was able to read 1 Ch data. Though I need to read complete data.

Please help.

0 Kudos
Message 1 of 7
(1,101 Views)

Try closing the file when you are done writing to it.  Then open it back up to read.

 

OR

 

Use the Set File Position to set the file pointer back to the beginning of the file before doing your reads.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 7
(1,062 Views)

Hi crossrulz,

 

Thanks for the reply.

I tried Set file pointer. And I am ending up with the Error 116.

Even I deleted writing gain, offset and x increment and only writing the waveform data.

Please see the fig. and the Vi

 

Thank you

Kiran

Read binary error.png

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

Sorry modified vi was missing

0 Kudos
Message 4 of 7
(1,052 Views)

So this time you turned off the Prepend Array Size on your write.  I think you want to turn that back to TRUE and then read 2D arrays until you reach the end of the file (I think its error code 4).  You can then append however you need to in order to have your channels properly put together.  I'm thinking it might be better to use a TDMS file so that you can make sure your channels' data are going to the right place and you get it properly when you read a channel.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 7
(1,041 Views)

Hi crossrulz,

 

I solved it. Tried closing and reopening the file and wirting the file with prepend to True.

 

Thanks

0 Kudos
Message 6 of 7
(1,039 Views)

Hi crossrulz,

 

Yes I was able to solve it by forcing prepend to true. But with TDMS file I am running into memory errors with bigger fetch sizes in Ni Scope

0 Kudos
Message 7 of 7
(990 Views)