07-23-2022 09:54 AM
Hi,
I have 15 .bin files , currently I am using notepad++ extension to view in hex.
In order to be precise , I have explained by problem in depth.
My purpose is to Retrieved Number of Packets and Parameters within each file.
1) Packet Information
For Eg: If a file has following value: ( If the a file is viewed in Hex in Notepad++)
0A27 B704 etc..
Questions
My challange
The files are large 400mB and even larger, I had written a routine in Labview using array to store the information its working but it gives memory full error if files are large.
07-24-2022 04:57 AM
A person stuck in similar problem, this has given motivation to choosed try Diadem once.
https://mathematica.stackexchange.com/questions/171892/how-to-read-this-dataset-with-dat-and-r64-fil...
07-24-2022 11:22 AM
Sorry, I am a "LabVIEW guy" (where the solution would be absolutely trivial! 😄 ) and don't know DIADEM, but there are a few issues I would like to point out so others understand the problem better.
@divgup1986 wrote:
Subject: "Retrieve Integer values from a Binary/Hex file"
It's a plain binary file! Just looking at it in hexadecimal format using some tool does not make it HEX. (Hex is a format (displaying binary data using characters 0..F), not a datatype)
@divgup1986 wrote:
The files are large 400mB and even larger, I had written a routine in Labview using array to store the information its working but it gives memory full error if files are large.
400mB (millibytes) is 0.4Bytes, so this is really, really (really!!!!) small! 😄 If it is actually 400MB, you probably want to use LabVIEW 64bit if you desire to process and display all of it at once, but it seems you only want to process a subset. Done right, you will not run out of memory, but we of course have no idea what you actually did. (You need to limit data-copies, indicators, detours, memory thrashing, etc. The code needs to be elegant!). Maybe you want to revisit your LabVIEW approach. Feel free to post in the LabVIEW forum and we will try to help. If possible, attach a small version of one of your files, e.g. with only a couple dozens of 128byte records.
07-26-2022 01:50 AM
Hi divgup1986,
To import data in DIAdem you can use a DataPlugin. On www.ni.com/dataplugins you find lots of common DataPlugins. If your file format is not supported there, you can create your own DataPlugin. In this case you need an exact description of the file format and some test files. Your description is good so far, but for me it is not clear what the exact data type the value in the binary file have.
Greetings
Walter
07-27-2022 03:20 AM
Maybe you want to revisit your LabVIEW approach. Feel free to post in the LabVIEW forum and we will try to help. If possible, attach a small version of one of your files, e.g. with only a couple dozens of 128byte records.
Hi,
Thanks , I will shortly get back with the code, you are correct that I may not have written the code in the best way possible. I will provide as much data possible.
Thanks
07-27-2022 04:57 AM
Hi,
I followed an internal example given in Diadem help for binary files, which says read the files as blocks.
Here is the attached code .
Option Explicit
Sub ReadStore(File)
Dim Block : Set Block = File.GetBinaryBlock()
Dim ChannelGroup : Set ChannelGroup = Root.Channelgroups.Add("MyChannelGroup")
Dim Channel1 : Set Channel1 = Block.Channels.Add("Channel1", eI16)
Dim Channel2 : Set Channel2 = Block.Channels.Add("Channel2", eI16)
Dim Channel3 : Set Channel3 = Block.Channels.Add("Channel3", eI16)
Dim Channel4 : Set Channel4 = Block.Channels.Add("Channel4", eI16)
ChannelGroup.Channels.AddDirectAccessChannel(Channel1)
ChannelGroup.Channels.AddDirectAccessChannel(Channel2)
ChannelGroup.Channels.AddDirectAccessChannel(Channel3)
ChannelGroup.Channels.AddDirectAccessChannel(Channel4)
End Sub
Using above script is given in example: 3, and it does following
Using above example, I am able see the values, as per required format : i.e First 16 bytes to Channel 1( value 1), next 16 Bytes to channel 2 ( value 1) as given in the example.
Next Step - 1
Now , I am stuck at finding a code to create a particular number of channels in a loop ( for eg: 64 channels) as given in above code using
Set Channel1 = Block.Channels.Add("Channel1", eI16
and add those channels to File using following command.
ChannelGroup.Channels.AddDirectAccessChannel(Channel1)
Next Step - 2
Once , the given number of channels will be created, I have to make algorithms to convert binary value to in each channel with the corresponding Mathematical Algorithm.
Is there any way possible to store different mathematical algorithms ( for Eg: we have 64 channels, so 64 mathematical algortihms).
While the Step-1 script will be running , while assigning the values to channels , corresponding algoithm will be selected and applied to that channel from a data base of algortihms.
Next-3
As type of algorithms are fixed, For: Eg scale by 90 , left shift by 4 and then scale by 120 etc..
My next step would be to create a GUI , where user can select algorithms against each channel and then , when a binary file is loaded , it will be converted directly into readings and can be viewed on reports.
Thanks for your reply.
07-27-2022 08:32 AM
Hi,
I have created a post in Labview Forum , as there the approach is different.
Kindly have a look , I have also shared, snippets, VI and two sample files.
https://forums.ni.com/t5/LabVIEW/Contenating-BIN-files-similar-to-R16-format-to-Graph/m-p/4245556/hi...
Thanks