06-26-2018 09:35 AM
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
Solved! Go to Solution.
06-26-2018 09:53 AM
06-26-2018 10:02 AM
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.
06-27-2018 05:46 AM
Thank you very much.
I understand now that one should use 'prepend array or string' feature, in order to directly read it in labview.
06-27-2018 05:56 AM
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.
11-04-2020 11:56 PM
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".
11-05-2020 05:02 AM
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?
11-05-2020 08:31 AM
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?
If you change default settings,
set the same when you are reading
Do the same in writre and read: