01-31-2014 12:09 AM
Dear All,
I have Binary file. I want to read Bytes based on Patterns and each channel value (Byte values -- > Float conversion) and storing it into Index array.
Please check the attachment for pattren format.
Here, the biggest problem is we will get only pattern style, Based on pattern the data is already stored in Binary file just we need to read it means we need to set the Timestamp based on this.
Please give me some idea to read this kind of pattern files.
BR,
Guru
01-31-2014 03:13 AM
Hi Munna,
that pattern is quite hard to understand. It seems there is some information missing…
In your pattern table the data size for e.g. ch1 is given as "1 byte", but in your time schedule you use two bytes for ch1. How are those "ch start position bytes" to be identified?
Byte values -- > Float conversion
How do you want to convert those bytes to Float (SGL or DBL)?
storing it into Index array
What is an "index array"?
It seems you have to create a table from your pattern which identifies the bytes in the file. That seems to be the trickiest part as in your pattern#2 example you already have made a mistake (for ch4 there is no marking at timestamp 70ms)…
01-31-2014 09:12 AM
Dear GerdW,
Thank you so much for your reply.
1. In channel 1 Data Length is 1Byte. The 1st Byte is Indicator (It's generally 1 or 0). For example 1 FF 0 BF 40 4C FF ....
Here, 1st 1byte is Indicator for ch1 next one byte is Data i.e.. FF. After that 0 is again indicator for 2nd channel and data is BF404CFF. Like this we need to calculate.
2.
Byte values -- > Float conversion
Based on my requirement I will use SGL or DBL. Currently anything is ok.
3. Once data is converted to Float value I have to store it into 2D- array.
It means ch1 data in Index 0 (1D array) ch2 in Index 1 (1D Array) and so on.
4. Regarding pattern, sorry I missed ch4. Yes your right, I have to read the Bytes based on the Table because data is aligned based on this pattern.
Please let me know if you need any other Information.
BR,
Munna
01-31-2014 11:16 AM - edited 01-31-2014 11:17 AM
Hi Munna,
are those identifier bytes header unique for each channnel? It would be easier to parse the bytestream with unique identifiers (to get rid of that pattern table)…
I would store the channel data in an array of cluster of 1D array. This prevents hassle as 2D arrays have to have the same number of rows for each column - and your channel data clearly will result in different number of rows…
01-31-2014 06:27 PM
Dear GerdW,
Identifier Byte length is Always 1byte it's Only One or Zero. Suppose if, One is there then Next bytes having some Hex values if Zero is comming Next data Bytes having zeros.
For Example, 1 BF 00 00 00 00 00 1 CF 40 1 4C 50 00 00 00 00
Here, 1st 1 represents ch1 Byte Length (1Byte)=BF
Next 00 Represents Ch2 and Byte Length (4Bytes)= 00 00 00 00
Next 1 Represents Ch3 and Byte Length (2Bytes)= CF 40
Next 1 Represents Ch4 and Byte Length (2Bytes)= 4C 50
Next 00 Represents Ch2 and Byte Length (1Bytes)= 00
Next 00 Represents Ch2 and Byte Length (1Bytes)= 00
If Identifier byte having Zero then we need to take the previous value for that channel.
Please let me know if it's not clear.
Thanks & Regards,
Guru
02-03-2014 09:13 PM
Dear GerdW,
Please give me some sample VI about this problem.
BR,
Munna
02-04-2014 02:16 AM
02-04-2014 04:30 AM
Dear GerdW,
Thank you so much for your reply.
I understood your Sample VI.
My biggest problem is, I don't know how to make that table to read Bytes from File (as per time intervals). Please give me some idea about this.
Thanks & Regards,
Munna
02-04-2014 04:34 AM
Hi Munna,
the idea is to create that table in the same way you did this in Excel. You created an overview of channel vs. time and then you parsed that overview to get the data order of your file.
Try to do the same with LabVIEW. Start with drawing a programming scheme (on paper!), then start to code in LabVIEW…
02-04-2014 05:25 AM
Dear GerdW,
Thank you so much for your suggentions and help.
I'm not getting any idea to make this Table in LabVIEW like Excel.
Can you give me some idea/sample VI, so that I will work on it.
Thanks & Regards,
Guru