問題:
How do I get a waveform in Matlab with the IVI-COM driver?
答案:
Here is some sample Matlab code. Note the IVI-COM driver and Shared components must already be installed.:
%To establish communication with the oscilloscope, you create a MATLAB COM
%object that represents an instance of the driver.
h = actxserver('TekScope.TekScope.1');
%Next, you need to initialize the driver.
invoke(h,'Initialize','GPIB0::1::INSTR',false,false,'');
hscope = get(h,'IviScope');
%Read the identification information by first getting the Identity interface and thenreading the properties of this interfaces.
hid = get(hscope,'Identity');
ms = get(hscope,'Measurements');
ms1 = get(ms,'Item',get(ms,'Name',1));
invoke(ms,'Initiate');
A = get(hscope,'Acquisition');
recordLength = get(A,'RecordLength');
data = zeros(recordLength,1);
disp('Fetching waveform');
timeout = 1000; % In milliseconds
data = zeros(recordLength,1);
initX = 0;
Xinc = 0;
[status,data,initX,Xinc] = invoke(ms1,'ReadWaveform', timeout, data, initX, Xinc);
t = initX:Xinc:initX+(Xinc*(recordLength-1));
plot(t,data)
此常見問答集適用於:
沒有任何產品系列
產品:
常見問答集 ID 52576
檢視所有常見問答集 »