cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
lala
Level VIII

How to use scripts to extract binary files with byte offset and reserved bytes into decimal data?

The document is divided into three parts:
A: The first eight bytes are the header (two integers of 4+4),

 

B: This is followed by 240 lines of uniform specifications.
The data structure for each row is as follows:
1. Two bytes are integers.
2. Four bytes are floating point.
3. Four bytes are floating point.
4. Two bytes are integers.
5. The remaining 14 bytes are reserved.


C: The last is the reserved null value.
How to restore this data to decimal data using JSL.

Thanks!

2022-07-21_21-27-07.png

1 ACCEPTED SOLUTION

Accepted Solutions
Craige_Hales
Super User

Re: How to use scripts to extract binary files with byte offset and reserved bytes into decimal data?

Load the data as a blob.

Use blobPeek(), similar to substr() for strings, but zero based, to pick out the segments.

Use blobToMatrix() to convert the segments to numbers.

blobToMatrix() can make 4- or 8-byte floats, 1-, 2-, 4-, and 8-byte signed or unsigned integers.

blobToMatrix also understands big vs little endian data: the least significant and most significant bits are sometimes swapped around. Most modern computes use little-endian representations.

Craige

View solution in original post

3 REPLIES 3
lala
Level VIII

Re: How to use scripts to extract binary files with byte offset and reserved bytes into decimal data?

  • This is how I try to identify the individual data structures for each row.

2022-07-21_21-50-11.png

Craige_Hales
Super User

Re: How to use scripts to extract binary files with byte offset and reserved bytes into decimal data?

Load the data as a blob.

Use blobPeek(), similar to substr() for strings, but zero based, to pick out the segments.

Use blobToMatrix() to convert the segments to numbers.

blobToMatrix() can make 4- or 8-byte floats, 1-, 2-, 4-, and 8-byte signed or unsigned integers.

blobToMatrix also understands big vs little endian data: the least significant and most significant bits are sometimes swapped around. Most modern computes use little-endian representations.

Craige
lala
Level VIII

Re: How to use scripts to extract binary files with byte offset and reserved bytes into decimal data?

Thank Craige!

2022-07-22_08-12-19.png