LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error in reading binary files: Error 116

Solved!
Go to solution

Hello,

 

I have saved 2-channel data as 2D array into a binary file ( image attached 'write_to_bin_file.png').

 

When I try to read the 2D data, I get an error saying that 'Error 116: Unflatten or byte stream read operation failed due to corrupt, unexpected, or truncated data'.

 

I attached the VI and the error too.

 

Did I do anything wrong while reading the 2D array? If so, can someone help me?

 

Thanks and Best regards,

Santhosh

0 Kudos
Message 1 of 8
(4,538 Views)
Solution
Accepted by topic author Santhosh_kth

file.png

Message 2 of 8
(4,531 Views)
Solution
Accepted by topic author Santhosh_kth

Since you did not prepend the array size (bad idea in this case), you will need to read -1 DBLs (read all of the data) and then reshape the array to get your 2D array.  Instead of reshape, you may need to use Decimate 1D Array and then Build Array.  It depends on how your data is actually formatted.


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
Message 3 of 8
(4,526 Views)

Thank you very much.

I understand now that one should use 'prepend array or string' feature, in order to directly read it in labview.

 

0 Kudos
Message 4 of 8
(4,492 Views)

Thank you.

 

Yes, you are right. I tested using -1 DBLs (read all the data) and then reshape the array. you get the original data back.

0 Kudos
Message 5 of 8
(4,491 Views)

i am facing the same issue. can you plz share your VI image how you resolve this?

i have used the "prepend array" feature as "T". 

0 Kudos
Message 6 of 8
(3,525 Views)

i have attached the image files of my read and write to binary file. i have tried two attempts to write binary file. one with using "prepend array as True" and in second attempt i didnot used it (as in screenshot). while reading the binary file for both cases i receive same error 116.

Actually, My application needs to write large input data size efficiently. Input data type is 2-channel floating point.i want to save my input data as it is in a file that is efficient. From search i found "write to binary file" is suitable. Before using "write to binary file" i saved my data using "write to measurement file". the issue that i faced is performance degradation. 

Any one can guide please?

Download All
0 Kudos
Message 7 of 8
(3,512 Views)

Do you write all the data in one go, or in parts?
If the second, why do you close and open the file every time in the loop?

 

write.png

 

If you change default settings,

w1.PNG

set the same when you are reading

r1.PNG

 

Do the same in writre and read:

 

wr.png

0 Kudos
Message 8 of 8
(3,500 Views)