How do you import LABVIEW time stamps into MATLAB
8 ビュー (過去 30 日間)
古いコメントを表示
Benjamin Dolgin
2016 年 1 月 27 日
コメント済み: Walter Roberson
2016 年 12 月 14 日
Bug in h5info.
Command
gr_inf=h5info(f_name, '/wfm_group0/axes/axis0' );
Produces an error:
Warning: There is no MATLAB integer type that corresponds to an HDF5 integer type with 16 bytes. The
data will be treated as an uninterpreted uint8 array.
> In h5info (line 74)
In read_scope_hws (line 17)
The file that is being read was created by the NI oscilloscope program.
Not surprisingly, a later statement
ref_time1=gr_inf.Attributes(9).Value;
produces an array of 16 two-byte int8 numbers instead of a 64 byte integer.
The problem is not due to not understanding which group or which attribute to read; the information in Attributes(9).Value is a time stamp. It is just that MATLAB and LABVIEW creators are not talking to each other. The file in question contains four time stamps; each produces a warning.
Does anybody know how to either:
1. Fix the bug in h5info.m
2. How to covert the received 64 bytes in a time stamp by hand
4 件のコメント
dpb
2016 年 1 月 27 日
編集済み: dpb
2016 年 1 月 27 日
http://www.ni.com/tutorial/7900/en/ says "The LabVIEW timestamp is a 128-bit data type...". That's 16-bytes which is what the hfinfo call thought was there. I don't see that the NI doc actually states about endianess, that would be an issue.
There's also the issue of whether it's Gregorian or Julian calendar as I note one respondent had issues with the Gregorian as claimed in the above link.
I was asking if you can't provide the actual 16 bytes returned and do you know what the answer is supposed to be?
I always loved NI hardware but detested their software libraries...I've not used any of their gear nor LABVIEW in over 20 years now...and can't says as how's I've missed it! :)
dpb
2016 年 1 月 27 日
編集済み: dpb
2016 年 1 月 27 日
OK, messing around w/ the example on the NI page, if I take their third example of fractional seconds of a string of '0xCCCCCCCCCCCCCCCD'
>> c='CCCCCCCCCCCCCCCD'; % ML character representation
>> atto=sscanf(c,'%lx') % the atto-seconds field
atto =
14757395258967641293
>> magn=uint64(2^64); % max 64-bit integer
>> f=double(atto)/double(magn) % convert to decimal (approx)
f =
0.8000
>>
That is what they say the value is after the 54 seconds in 12/31/1903 23:59:54.800.
If you've got the 16 bytes you're almost there it would seem.
採用された回答
Benjamin Dolgin
2016 年 1 月 29 日
編集済み: dpb
2016 年 2 月 12 日
5 件のコメント
Guru Subramani
2016 年 12 月 14 日
"Time stamp actually consists of two int64; the first one is signed the second is unsigned " - Benjamin Dolgin, I think this describes what is going on clearly. Thanks!
Walter Roberson
2016 年 12 月 14 日
"MATLAB h5info has a bug: it does not recognize int128 variables"
That is not a bug. MATLAB does not have any int128 data type. It is a limitation. To handle int128 or uint128, Mathworks would have to create a complete extended-precision software mathematics facility: all other calculations in basic MATLAB are done with hardware instructions, but the x64 instruction set does not offer 128 bit integer operations.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Time Series Objects についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!