No BSD License  

Highlights from
gettemp

from gettemp by Yuval Ben-Dov
Read predefined channels form an Agilent 34970A data logger through NI GPIB interface.

gettemp(varargin);
function varargout = gettemp(varargin);
% TO BE USED WITH HP 34970A DATA LOGGER.
% THE LOGGER NEEDS TO BE IN GPIB MODE, CHANNEL 9
% (DEFAULT FACTORY SETTINGS); 
% ASSUMES NI GPIB BOARD INDEX 0, CAN BE MODIFIED IN THE CODE.
%
% hp = gettemp; 
% will initialize the data logger for temperature logging including:
% - define a GPIB object, and its settings
% - abort current scans and remove data from the buffer
% - define channels to be monitored
%   The channels to be scans are defined in the code (the variable
%   CHANNELS), and should be modified to meet the requirement.
% The output argument (hp) isthe GPIB object, in open status.
% YOU HAVE TO CLOSE THE GPIB OBJECT WHEN YOU'RE DONE.
%
% TC = gettemp(hp);
% where hp is a GPIB object in open status, and the logger is initialized
% will read the temperature from the predefined channels.
%

% Yuval Ben-Dov, November 2004.

CHANNELS = '101,106:107';           % channels to be read, a string in the form '101,103:105'
                                    % if needed to be defind often could
                                    % become an argument.

if (nargin==1), % if GPIB object exist read temperatures
    hp = varargin{1};
    TC = query(hp,'READ?');         % read temperature;
    varargout{1} = TC;
else,           % otherwise define an object and initialize the logger.
    hp = gpib('ni',0,9);            % modify if need different board / channel
    set(hp,'timeout',1);            % to avoid long waiting when there is a problem...
    fopen(hp);
    fprintf(hp,'ABOR');             % abort running scan
    query(hp,'R?');                 % delete data from the buffer
    fprintf(hp,['ROUT:SCAN (@' CHANNELS ')']); % set the channels to be scanned
    varargout{1} = hp;
end;

Contact us at files@mathworks.com