力科示波器 matlab,有没有人研究过力科示波器的二进制文件(.trc)怎么读取?...
該樓層疑似違規(guī)已被系統(tǒng)折疊?隱藏此樓查看此樓
自個(gè)兒搞清楚了……不算很難,就是略繁。重點(diǎn)是參照
forums.ni.com/attachments/ni/60/4652/2/LeCroyWaveformTemplate_2_3.pdf
中的格式說明。以下給出代碼(其實(shí)可以進(jìn)一步整理成函數(shù)的,我懶得弄了……):
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}]
順便,那個(gè)MATLAB的.m文件其實(shí)是bug,它在算文件位置的時(shí)候丟了一項(xiàng)。(當(dāng)然這項(xiàng)一般是空的所以通常不會(huì)引發(fā)問題。)
總結(jié)
以上是生活随笔為你收集整理的力科示波器 matlab,有没有人研究过力科示波器的二进制文件(.trc)怎么读取?...的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: ArcGIS server如何将自己的小
- 下一篇: matlab meas 函数_力科示波器