バイナリファイルの指定されたバイトを浮動小数点数に変換するにはどうすればよいですか?たとえば、図の最初の行の04-07バイトを浮動小数点数に変換します。専門家に感謝します。

正しい結果は次のとおりです:1006.27
バイナリファイルは次のとおりです。
598A0F0548917B44F6C87B44855B7B44D7637B44DA57BE45140B000000000000
スクリプティングウィンドウズ回复:怎的将二進制文件中的指定字节変換化是点数?excel VBA

返信:バイナリファイルの指定されたバイトを浮動小数点数に変換するにはどうすればよいですか?この機能は実装できません
CopyMemory v, b(0), 4
Re:怎的将二進制文件中的指定字节転化是早点数字?
filename = Save Text File(
"$temp/deleteme.bin",
Hex To Blob( "598A0F0548917B44F6C87B44855B7B44D7637B44DA57BE45140B000000000000" )
);
// load the entire file. You could use the blob() parameter
// to load a smaller part of the file by offset and length.
blobdata = Load Text File( filename, blob() );
// convert the binary data to a matrix. The 4 means 4 byte chunks
// and "little" means the least significant byte comes first (little endian.)
numbers = Blob To Matrix( blobdata, "float", 4, "little" );
// print the values; JMP uses 8-byte floating point and will
// display more resolution than is actually available.
For( i = 1, i <= N Rows( numbers ), i += 1,
Write( "\!n", i, " ", numbers[i] )
);
1 6.74923813801151e-36
2 1006.27001953125
3 1007.14001464844
4 1005.42999267578
5 1005.55999755859
6 6090.9814453125
7 3.97408244482518e-42
8 0
他の方向に変換するための同様の関数、Matrix ToBlobがあります。
4バイトの浮動小数点数は6桁または7桁の有効数字です。 8バイトの浮動小数点数は15桁または16桁の有効数字です。
https://en.wikipedia.org/wiki/Single-precision_floating-point_format
https://en.wikipedia.org/wiki/Double-precision_floating-point_format
便利なビット表示機能を備えたWindowsの16進計算機を使用する場合は、必ずバイトを逆にしてください。
48917B44-> 447B9148-> 0 10001000 11110111001000101001000-> 2 ^(136-127)*(1 + 1/2 + 1/4 + 1/8 + 1/16 + 0/32 + 1/64 + ...)
Re:バイナリファイルの指定されたバイトを浮動小数点数に変換するにはどうすればよいですか?専門家に感謝します!
このバイナリファイルで
00、01バイト-年、月、日
02、03バイト-時分割

コードのセグメンテーションを増やしますか?再度、感謝します!
numbers = Blob To Matrix( blobdata, "float", 4, "little" );
Re:怎的将二進制文件中的指定字节転化是早点数字?これらの4バイトは、4つの1バイトuintまたは2つの2バイトuintとして処理できます。 Uintは符号なし整数を意味します。 floatの代わりにuintを使用します。 それらがどのように時間を表すかを理解する必要があります。デコードされていない例が1つしかない場合は明らかではありません。
Re:バイナリファイルの指定されたバイトを浮動小数点数に変換するにはどうすればよいですか?私はまだこの操作を実行する能力を持っています。
ファイル全体をアップロードしました。このようなデータは5070行あります。
エンコードする方法がわかりますか?
ありがとう!
00 to 01 bytes: indicates the date. If the value is num, the date calculation method is as follows:
year=floor(num/2048)+2004;
month=floor(mod(num,2048)/100);
day=mod(mod(num,2048),100);
02 to 03 bytes: indicates the number of minutes from 0 o 'clock to the present
04 to 07 bytes: float
08 to 11 bytes: float
12 to 15 bytes: float
16 to 19 bytes: float
20 to 23 bytes: float
24 to 27 bytes: integer
28 to 31 bytes :(reserved)
Re:怎的将二進制文件中的指定字节転化是早点数字?このようなデータのグラフを作成できます。 外れ値がいくつかあるようです!
zipファイルから抽出され、外れ値を確認するためにグラフ化されたデータ。
/*
00 to 01 bytes: indicates the date. If the value is num, the date calculation method is as follows:
year=floor(num/2048)+2004;
month=floor(mod(num,2048)/100);
day=mod(mod(num,2048),100);
02 to 03 bytes: indicates the number of minutes from 0 o 'clock to the present
04 to 07 bytes: float
08 to 11 bytes: float
12 to 15 bytes: float
16 to 19 bytes: float
20 to 23 bytes: float
24 to 27 bytes: integer
28 to 31 bytes :(reserved)
*/
za = Open( "z:/445.zip", "zip" ); // open the zip file
datasetname = (za << dir)[1];
blobdata = za << read( datasetname, Format( blob ) ); // load the member as a blob
//
// the following 3 lines import ALL of the data each time. Later,
// only use the columns that were really in that format.
//
integer2 = Blob To Matrix( blobdata, "uint", 2, "little", 16 ); // get the 2-byte unsigned ints for columns 0-1 and 2-3
integer4 = Blob To Matrix( blobdata, "uint", 4, "little", 8 ); // get the 4-byte unsigned ints for columns 24-27 and 28-31
float4 = Blob To Matrix( blobdata, "float", 4, "little", 8 ); // get the 4-byte floats for columns 4-23
// pre-process the matrix columns; no explicit loop is required...
years = Floor( integer2[0, 1] / 2048 ) + 2004;
months = Floor( Mod( integer2[0, 1], 2048 ) / 100 );
days = Mod( Mod( integer2[0, 1], 2048 ), 100 );
seconds = 60 * integer2[0, 2];
// create a table. You could also use new table, but the v1...v5 would be a little more code to type
dt = As Table(
years,
months,
days,
seconds,
float4[0, 2 :: 6],
integer4[0, 7 :: 8],
<<COLUMNNAMES></COLUMNNAMES>
Re:バイナリファイルの指定されたバイトを浮動小数点数に変換するにはどうすればよいですか?専門家の助けをありがとう!
JMPは強力すぎます!
JMPはこんな感じで使えます!
私はあまり知らない。
専門家に改めて感謝します!
Re:バイナリファイルの指定されたバイトを浮動小数点数に変換するにはどうすればよいですか?私はまだ専門家に尋ね続ける必要があります:
このようなデータの最後の480行だけがこのファイルから抽出された場合、コードを変更するにはどうすればよいですか?
専門家に感謝します!
このようなデータは、元のファイルでは5070行です。また、元のバイナリファイルの終わりは、データではなく他のテキストです。
Re:バイナリファイルの指定されたバイトを浮動小数点数に変換するにはどうすればよいですか?このように修正しようとしましたが、失敗しました。
r = N Row( years );
dt = As Table(
years,
months,
days,
seconds,
float4[r - 479 :: r, 2 :: 6], ////
integer4[r - 479 :: r, 7 :: 8], ///
<<COLUMNNAMES></COLUMNNAMES>
Re:怎的将二進制文件中的指定字节転化是早点数字?ログにメッセージがありましたか?
これらの配列(年、月、日、秒)はすべて、同じ処理が必要になります。たとえば、years [r-479 :: r]です。
テーブルを作成した後、テーブルから不要な行を削除する方が簡単な場合があります。 日付列を使用して、気になる範囲を選択してみてください。
Re:バイナリファイルの指定されたバイトを浮動小数点数に変換するにはどうすればよいですか?この図を見て、私は2つの疑問を提起します。
1.グラフィックが連続的であり、日付間隔の影響を受けないようにするために、それを実現する簡単な方法はありますか。 X軸として行番号列のみを使用します
Column( "reserved" ) << Formula( Row() );dt << run formulas;Column( "reserved" ) << deleteFormula;
……
Variables( X( :reserved ), Y( :v5 ), Y( :v4 ), Y( :v3 ), Y( :v2 ), Y( :v1 ), Y( :xx ) ),

2.実際にはこのデータ株の取引データ。
JMPはこのような日本のローソク足を直接作ることができますか?この種のグラフはExcelで簡単に作成できます

どうもありがとうございます!