0

私が作成したこの Matlab 関数は、基本的に、tektronix オシロスコープによって生成された csv ファイルを取得し、2 つのチャネルの信号をプロットします。ただし、作成されたすべてのテストおよび csv ファイルには、異なる数のポイントがあり (この場合は9999[ を意味B16:B10014]します)、excell( tek0001ALL) 内のワークシートの名前は異なります。私はmatlabを初めて使用しますが、これはコード効率の良い方法ではない可能性があるため、最後に入力されたセルを検出できる生成されたcsvをプロットできる一般的なコードを作成する簡単な方法があるかどうか疑問に思っていましたこれらの列とセルの数なので、多くのテストを実行する必要がある場合があるため、ポイントの数になることもあります。

function [ Vs1, Vs2, t ] = scope![enter image description here][1]( filename )

% Read the Y axis data of the scope data in volts CH1
Vs1 = xlsread(filename, 'tek0001ALL', 'B16:B10014');
% Read the Y axis data of the scope data in volts CH2
Vs2 = xlsread(filename, 'tek0001ALL', 'C16:C10014');
% Read the sample interval from the scope data in seconds
sample_interval = xlsread(filename, 'tek0001ALL', 'B7');
% Create time axis
t = 0:sample_interval:(9999*sample_interval)-sample_interval;

%Plot waveform
figure
subplot(2,1,1);
plot(t,Vs1);
title('Sensor Input Measurements for 100pc Discharge ');
xlabel('Time[s]');
ylabel('Voltage[V]');
grid on;
grid minor;

subplot(2,1,2);
plot(t,Vs2);
title('Sensor Output Measurements for 100pc Discharge');
xlabel('Time[s]');
ylabel('Voltage[V]');
grid on;
grid minor;

end

CSV ファイル形式の例は次のとおりです。

Model,DPO3034
Firmware Version,1.08

Point Format,Y,
Horizontal Units,S,
Horizontal Scale,8e-07,
Sample Interval,8e-10,
Record Length,10000,
Gating,0.0% to 99.9900%,0.0% to 99.9900%
Probe Attenuation,1,1
Vertical Units,V,V
Vertical Offset,0,0
Vertical Scale,0.05,0.001
Label,,
TIME,CH1,CH2
-1.4664e-06,-0.003,-0.00036
-1.4656e-06,-0.003,-0.00036
-1.4648e-06,-0.003,-0.00036
-1.4640e-06,-0.001,-0.00032
-1.4632e-06,-0.003,-0.00036
-1.4624e-06,-0.001,-0.00036
-1.4616e-06,-0.001,-0.0004
-1.4608e-06,-0.003,-0.00036
4

1 に答える 1