From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to read .bin (raw file)

Solved!
Go to solution

I have a raw data file (kidney.bin) which can be read using Matlab. It shows a 2D Array in Matlab. How can I read this file in LabVIEW ?? Please go through the attachment and let me know the solution.

0 Kudos
Message 1 of 9
(5,086 Views)
Solution
Accepted by meBaga

Well, there is no documetation on the format, but it seems U8, so endian is irrelevant. Looks like it is one flat binary file without header or dimension information. Here's some simple code that seems to reproduce your expected result. (LabVIEW 8.2)

 

 

Download All
Message 2 of 9
(5,075 Views)

Well, 

 

Thanks for your reply. I have got the solution also Smiley Happy . Can you tell me if I can generate this kind of (.bin) file from an array or .txt file containing an array.

0 Kudos
Message 3 of 9
(5,064 Views)

Well, if you have the array, you just transpose it, reshape it to a 1D array and write it to a binary file without size information.

If you have a text file, you need to parse it first. How does the text file look like?

 

Download All
0 Kudos
Message 4 of 9
(5,060 Views)

This is the text file.

 

 

0 Kudos
Message 5 of 9
(5,056 Views)

Well, each file seems to contain an index followed by 16 bytes formatted in hexadecimal, space delimited, and padded to two digits. line termination seems to be \s\r\n\n.

 

If you know that the file is clean, you can ignore the data up to the ":" and simply parse the rest of each line (ignoring the empty lines) 

0 Kudos
Message 6 of 9
(5,047 Views)

Well the file is clean, It is containing the actual data I want. We have checked it. How can I ignore the data upto the : using LabVIEW, I also need it to be in Array format, when I am calling it in LabVIEW using Text reader VI, I can see the output but in String format.

 

I also need it to be converted into decimal value (U8 format).

0 Kudos
Message 7 of 9
(4,944 Views)

https://decibel.ni.com/content/docs/DOC-9905

 

I got this, Now I am trying to finish it. 

0 Kudos
Message 8 of 9
(4,939 Views)

That link won't really help you because you also have delimiters netween the elements.

0 Kudos
Message 9 of 9
(4,923 Views)