How do extract parts of a binary file and evaluate them separately?Hello!
For example this file with this script can get the first data is a date.

How do I use a script to extract this "A2 3F 32 01"
and use a script to calculate its corresponding decimal value= 20070306
Thanks!
Automation and ScriptingQuality and Process EngineeringWindowsRe: How do extract parts of a binary file and evaluate them separately?Thanks!
Re: How do extract parts of a binary file and evaluate them separately?
How can take something in hexadecimal form and compute it as a floating point?
~D9~40~D9~CE
The following code ran incorrectly
b = Char To Blob( "~D9~40~D9~CE", "ascii~hex" );
f = Blob To Matrix( b, "float", 4, "little", 4 );
Thanks!
Re: How do extract parts of a binary file and evaluate them separately?Best of luck
Re: How do extract parts of a binary file and evaluate them separately?Thank Jim!
Yes, I got this code from Craige.
This code is useful when it knows the binary data structure.
But this new file I don't know its data structure.I'm on a quest.
I'm wrapping this file at 00 intervals.I get the data for this.
Except for the first line which I know contains the date.
But the data starting in the second line is integer data, floating point data.But which field is a floating point, or an integer.I don't know.

I can only restore the comparison field by field.
I still haven't figured it out yet.
Re: How do extract parts of a binary file and evaluate them separately?Your code
bb = Load Text File( "I:\E\00820070306.zst", blob() );
ymd = Blob To Matrix( bb, "uint", 4, "little", 8 );
is creating a 2 dimensional matrix you are calling "ymd" with the values converted to decimal values. All you have to do, is to create a new data table, then create a new column and set the values in the new column to the first column in the matrix ymd.
Names Default To Here( 1 );
bb = Load Text File( "I:\E\00820070306.zst", blob() );
ymd = Blob To Matrix( bb, "uint", 4, "little", 8 );
dt = New Table( "zst" );
dt << New Column( "col 1" );
Column( dt, 1 ) << set values( ymd[0, 1] );
Then just repeat it for the remaining 7 columns in the matrix

Re: How do extract parts of a binary file and evaluate them separately?Thanks!

Re: How do extract parts of a binary file and evaluate them separately?Maybe BLOB Peek(blob, offset, length) would work? Also this might be a good watch Importing Binary Data with JSL (2022-EU-45MP-946)
Re: How do extract parts of a binary file and evaluate them separately?bb = Load Text File( "I:\E\00820070306.zst", blob() );
ymd = Blob To Matrix( bb, "uint", 4, "little", 8 );
a=Munger(char(bb),contains(char(bb),"(")+4,12);
b=Char To blob(a, "utf-8" );;
mat=blobtomatrix(b, "uint", 4, "little", 8 );