Kontaktaufnahme

Live-Chat mit Tektronix-Vertretern. Verfügbar von 9 bis 17 Uhr CET Geschäftstage.

Anrufen

Kontaktieren Sie uns telefonisch unter

Verfügbar von 9 bis 17 Uhr CET Geschäftstage.

Download

Laden Sie Handbücher, Datenblätter, Software und vieles mehr herunter:

DOWNLOADTYP
MODELL ODER SCHLÜSSELWORT

Feedback

How do I use TVC ActiveX control in Matlab?

Frage:

How do I use TVC ActiveX control in Matlab?

Antwort:

Here is a simple example using the TVC activex control:


function get_waveform_tvc;
if (exist('instrHandle'))
delete(instrHandle)
end
clear all
instrHandle = actxserver('TVC.TvcCtrl.1');
instrHandle.Descriptor = 'GPIB0::1::INSTR';
out = instrHandle.Query('* IDN ?');
recordLength = instrHandle.Query('HORIZONTAL:RECORDLENGTH?');
instrHandle.WriteString(' DATA :START 1');
instrHandle.WriteString([' DATA :STOP ' num2str(recordLength)]);
instrHandle.WriteString(' DATA :WIDTH 1');
instrHandle.WriteString(' DATA : ENC RPB');
instrHandle.WriteString('Curve?')
str = instrHandle.ReadPartialString(2);
%% section of code to make sure that the response is valid. If
%% acquisition takes long time the response may not be empty
k = 0;
while isempty(str)
   str = instrHandle.ReadPartialString(2);
   k = k + 1;
       %break
    end
endif isempty(str)
   error(['Empty curve header for CURVE query response: ',str])
end   
if ~strcmp(str(1),'#')
   error(['Incorrect curve header (not #) for CURVE query response: ',str])
end
%pause(0.1)
recordLength = str2num(instrHandle.ReadPartialString(str2num(str(2))));
out = recordLength;
           % These appeared to be most reliable and common settings, may need to change
DATA _TYPE = 17;
BYTE_ORDER = 1;
readLength = recordLength; % could be something smaller
switch DATA _TYPE
case 17
   % this is the only more or less reliable setting
   % that handles large recordlengths
   out = (instrHandle.ReadIEEEBlock( DATA _TYPE,BYTE_ORDER,readLength))';
   out = double(int16(out)); % I am not sure that this is necessary, check the data types. Depends on MATLAB version
case {18,2,4,5}
   out = (instrHandle.ReadIEEEBlock( DATA _TYPE,BYTE_ORDER,readLength))';
case 2
   out = (instrHandle.ReadIEEEBlock( DATA _TYPE,BYTE_ORDER,readLength))';
otherwise
   error('Incorrect Data type')
end
ymult = str2num(instrHandle.Query('WFMP:YMULT?'));
yoff = str2num(instrHandle.Query('WFMP:YOFF?'));
xmult = str2num(instrHandle.Query('WFMP:XINCR?'));
xoff = str2num(instrHandle.Query('WFMP:PT_OFF?'));
xzero = str2num(instrHandle.Query('WFMP:XZERO?'));
ydata = ymult*(out - yoff);
xdata = xmult*((0:length(ydata)-1)-xoff)+xzero;
plot(xdata, ydata)
%After all data is read, use this, some instruments may not require this, it should return emty string then.
%out = instrHandle.ReadPartialString(2); % read the semicolon and newline character


Diese FAQs beziehen sich auf:

Keine Produktreihe

Produkt:

FAQ-ID 52726

Alle FAQs ansehen »