LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Writing Binary Files for Offline Sorter (16 Bit)

Yeah, I had that figured out and knew it worked. The issue was from the start that there is a significant loss of resolution with 8bit data as opposed to 16bit which causes significant issues with processing it. Is there another way to write it to a 16bit number that wouldn't interlace the extra 'digit' (which is only 0's in the sample file as it counts from 0 to 20)?

0 Kudos
Message 11 of 18
(1,122 Views)

 


@armlx wrote:

The issue was from the start that there is a significant loss of resolution with 8bit data as opposed to 16bit which causes significant issues with processing it. Is there another way to write it to a 16bit number that wouldn't interlace the extra 'digit' (which is only 0's in the sample file as it counts from 0 to 20)?


 

You are really confusing here. I thought the format is dictated by the sorter. In this case you have no choice on datatype. Do whatever the sorter wants.

 

I reaally don't understand your perceived problem. You cannot create bits out of hot air.

0 Kudos
Message 12 of 18
(1,112 Views)

Lets try this from the top.

 

The files I am getting out of Labview when I am writing a 16 bit integer are, as you noted when looking at the file, writing the Int16 as a pair of Int8s. The program I plan on using will read these each individually and requires an input of one whole Int16, which again is not what I am getting out of Labview. I want to know how to get this out of Labview.

0 Kudos
Message 13 of 18
(1,105 Views)

 


armlx wrote:

The files I am getting out of Labview when I am writing a 16 bit integer are, as you noted when looking at the file, writing the Int16 as a pair of Int8s. The program I plan on using will read these each individually and requires an input of one whole Int16, which again is not what I am getting out of Labview. I want to know how to get this out of Labview.


 

NO! Whatever you are saying makes no sense at all!

 

Binary files are just a long flat sequence of bits and it is up to the reading program to decide how to slice it. It can be read as U8, half as many U16, another half as many I32, another half as many DBLs, or another half as many CDBs, etc.. As I said, there are no delimiters, there are no "dimensions"!

Could it be that the file needs a header, instructing the reader to interpret the data in a certain way? Maybe a special extension?

 

You said the that matlab can create a proper file. Is that the "good" file you attached earlier? That is not 16 bit data if it is counting from 0 to n. As I said, to duplicate the good file, all you need is convert to U8. You cannot have 16 bit resolution taking up only 8 bytes.

 

I feel like talking to a wall. Is there an online manual describing the offline sorter file input specification?

 

0 Kudos
Message 14 of 18
(1,098 Views)

 


@altenbach wrote:

 

 

Is there an online manual describing the offline sorter file input specification?

 


 

 

Sounds like the DDT format.

 

http://hardcarve.com/wikipic/PlexonDataFileStructureDocumentation.pdf

0 Kudos
Message 15 of 18
(1,093 Views)

I've figured out the source of the issue.

 

When Labview writes binary, there is spacing between the bytes. If you open it as a text file, it looks like

 

(int16part1) (int16part2) (int16number2part1) ....

 

The OLS reads those breaks as deliniations between individual numbers, so it reads each byte as an int8. I need Labview to write the binary with no spacing between bytes, only between samples written. Can I do this?

0 Kudos
Message 16 of 18
(1,059 Views)

 


@armlx wrote:

I've figured out the source of the issue.

 

When Labview writes binary, there is spacing between the bytes. If you open it as a text file, it looks like

 

(int16part1) (int16part2) (int16number2part1) ....

 

The OLS reads those breaks as deliniations between individual numbers, so it reads each byte as an int8. I need Labview to write the binary with no spacing between bytes, only between samples written. Can I do this?


Post the code you are using to write the data. You are doing something wrong and without seeing it is impossible to tell you what is wrong. LabVIEW is capable of writing data in ANY format. You need to know what you want the output to look like and write the code to produce that data stream. Are you adding line terminations or the length field when you write the data?

 

Also, you do realize that in the picture of the code you posted that the conversion from a double to a U16 will result in a loss of data, right? You are taking a 32 bit value an saving only 16 bits of it.

 



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 17 of 18
(1,052 Views)

 


armlx wrote:

The OLS reads those breaks as deliniations between individual numbers, so it reads each byte as an int8. I need Labview to write the binary with no spacing between bytes, only between samples written. Can I do this?


 

Yes, LabVIEW can do anything. You are still making absolutely no sense, because binary files don't have a concept of "spacing". If the program wants a special delimiter, you need to tell us what that delimiter is.

(Note that in the hex display above, the "spacing" between words is just a display convention and is missing from the underlying data.)

 

All you showed us so far is a good and a bad file, but apparently you want something entirely different.

0 Kudos
Message 18 of 18
(1,043 Views)