05-09-2018 02:21 PM
Hello guys,
A third party sw tool measures some parameters from a battery and outputs a file (which iam thinking is binary). The same sw tool also has the capability to convert this file to a .txt file.
Iam trying to read this (binary file) to avoid having to do the conversion on the (sw tool) it self.
i tried to follow a similar approach as this post here but no joy.
https://forums.ni.com/t5/LabVIEW/Binary-file-of-unknown-formats/td-p/512870
any help on this will be appreciated.
kind regards
05-09-2018 02:32 PM - edited 05-09-2018 02:35 PM
Hi El_Tipo,
it would help when you would attach this "binary" file instead of the already converted text file! (ZIP it…)
And even better would be to also attach a description of the internal file format of this "binary file"…
I tried to follow a similar approach as this post here but no joy.
Well, that would only makes sense when your "binary file" uses a very similar encoding (aka file format) as the file in this 11 year old thread! That's why I asked for a file format description…
05-09-2018 04:05 PM
GerdW,
Thanks for the reply.
I of course failed in adding the file of interest.
attached you can find the file.
the actual description i do not know it other than what the .txt file already provides.
let say that the number of columns is never going to change.
05-09-2018 04:16 PM
i cant send this file through here.
i have tried to zip it, to send it raw, to zip it and renaming the extension from .rar to .par no joy.
is there any other way for me to upload this file?
05-09-2018 04:30 PM
Looking at your file, I see that a typical row in your table reads like:
1 0 1 0d 00:00:0 0d 00:00:0 0 0 0 13.551 R 0 04/16/2018 8:41:07 AM 0.00000 0.00000 300 10 0b0110000000000001 0 65535 0 65535 0 1 21.5 13.553 0.000 0.000 1 13 13 554 4553 65535 65535 65535 1.200 16.800 0b0000000011000000 43 0b0000000000000000 3391 3385 3390 3387 0 0 0.89906 C 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000
I don't think you can easily have LabVIEW read that as a double. What happens if you first read the entire thing in as a string?
@El_Tipo wrote:
i cant send this file through here.
i have tried to zip it, to send it raw, to zip it and renaming the extension from .rar to .par no joy.
is there any other way for me to upload this file?
Could you save your binary file with a .txt extension? I don't think zipping it is actually necessary.
05-09-2018 04:44 PM
05-09-2018 06:22 PM
"Binary" does not mean anything specific. Everything involving computers is binary one way or another.
Place your LabVIEW code AND the binary file in a zip file and attach it here (in windows explorer, select the files then right-click...send to... compressed folder (don't do weird things such as RAR or similar)). The forum accepts zip files just fine, independent on how you are naming the binary file inside it. The code would be interesting because your image is very ambiguous. Apparently, the file is not completely binary data, because you read some of it as text so there seems to be a a header.
If you add a diagram comment like "this is what I guess...", we can't even tell if your constant is SGL or DBL or even complex. Do you know it is little endian? What is the purpose of the last read operation? What's up with all these coercion dots?
05-09-2018 06:33 PM
@altenbach wrote:
If you add a diagram comment like "this is what I guess...", we can't even tell if your constant is SGL or DBL or even complex.
Agree with everything, except we know the constant is a DBL 🙂
05-09-2018 07:00 PM
True, if we follow the wire all the way to the indicator, far away from the comment. 😉
We still don't know if DBL is correct. 🙂
05-09-2018 07:13 PM
okay, here is the file zipped.
Altenbach,
I assumed that the file had a header that could be readable with the read txt files. i was wrong.
the image that i attached was what i found to be the closest scenario on the forum to what i was trying to accomplish here. this happened to be the VI you created on that particular post (with minor changes- but wrong nonetheless)
I tried to guess what was the size of the first three rows of the file (which has the information that i dont care about) and then using your approach i tried to then read the 2D array of the rest of the file, but the values are completely off.