%AUTOSETUP M-Code for communicating with an instrument. 
%  
%   This is the machine generated representation of an instrument control 
%   session using a device object. The instrument control session comprises  
%   all the steps you are likely to take when communicating with your  
%   instrument. These steps are:
%       
%       1. Create a device object   
%       2. Connect to the instrument 
%       3. Configure properties 
%       4. Invoke functions 
%       5. Disconnect from the instrument 
%  
%   To run the instrument control session, type the name of the M-file,
%   Autosetup, at the MATLAB command prompt.
% 
%   The M-file, AUTOSETUP.M must be on your MATLAB PATH. For additional information
%   on setting your MATLAB PATH, type 'help addpath' at the MATLAB command
%   prompt.
%
%   Example:
%       Autosetup;
%
%   See also ICDEVICE.
%

%   Creation time: 04-Feb-2009 10:10:49 


% Create a device object. 
deviceObj = icdevice('AgilentU2701A.mdd', 'USB0::2391::10520::MY48150005::0::INSTR');

% Connect device object to hardware.
connect(deviceObj);

% Execute device object function(s).
groupObj = get(deviceObj, 'Measurement');
groupObj = groupObj(1);
invoke(groupObj, 'AutoSetup');

% Query property value(s).
get1 = get(deviceObj.Channels(1), 'Enabled');

% Configure property value(s).
set(deviceObj.Channels(1), 'Enabled', 'on');

% Execute device object function(s).
groupObj = get(deviceObj, 'Measurements');
groupObj = groupObj(1);
[waveformarray, initialx, xincrement]= invoke(groupObj, 'ReadWaveform', 10000);
data = waveformarray';
plot(data)

% Disconnect device object from hardware.
disconnect(deviceObj);

% Delete object.
delete(deviceObj);
