力科示波器 matlab,有没有人研究过力科示波器的二进制文件(.trc)怎么读取?...
該樓層疑似違規已被系統折疊?隱藏此樓查看此樓
自個兒搞清楚了……不算很難,就是略繁。重點是參照
forums.ni.com/attachments/ni/60/4652/2/LeCroyWaveformTemplate_2_3.pdf
中的格式說明。以下給出代碼(其實可以進一步整理成函數的,我懶得弄了……):
str = OpenRead[(*文件地址*), BinaryFormat -> True];
byte = "Integer8";
word = "Integer16";
long = "Integer32";
string = "TerminatedString";
float = "Real32";
double = "Real64";
SetStreamPosition[str, 0];
lengthofwavedesc = 8;
headlength = StringLength@BinaryRead[str, string] - lengthofwavedesc;
l@wavedesc = read[36, long];
l@usertext = read[40, long];
l@trigtimearray = read[48, long];
l@ristimearray = read[52, long];
l@wavearray = read[116, long];
read[pos_, type_] := (SetStreamPosition[str, headlength + pos]; BinaryRead[str, type])
readlist[pos_, type_, length_] := (SetStreamPosition[str, headlength + pos];
BinaryReadList[str, type, length])
raw = readlist[l@wavedesc + l@usertext + l@trigtimearray + l@ristimearray, byte,
l@dataarray@1];
{vertical@gain, vertical@offset} = readlist[156, float, 2];
data = vertical@gain * raw - vertical@offset;
horizon@interval = read[176, float];
horizon@offset = read[180, double];
rightboundary = horizon@interval (l@wavearray - 1) + horizon@offset;
Close@str;
ListLinePlot[data[[;; ;; 10]], DataRange -> {horizon@offset, rightboundary}]
順便,那個MATLAB的.m文件其實是bug,它在算文件位置的時候丟了一項。(當然這項一般是空的所以通常不會引發問題。)
總結
以上是生活随笔為你收集整理的力科示波器 matlab,有没有人研究过力科示波器的二进制文件(.trc)怎么读取?...的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: ArcGIS server如何将自己的小
- 下一篇: matlab meas 函数_力科示波器