Code covered by the BSD License  

Highlights from
Educational Lab Report Data Acquisition Example

image thumbnail

Educational Lab Report Data Acquisition Example

by

 

13 Feb 2006 (Updated )

This is an example on how one might use the notebook feature to create a lab to do data acquisition

Editor's Notes:

This file was a File Exchange Pick of the Week

simpledaq(device,id,Fs)
function  daqOutput = simpledaq(device,id,Fs)
%% Example data acquisition function
% This demonstration shows the procedure for acquiring data.
% This demo requires the Data Acquisition Toolbox

%% Create object
ai = analoginput(device,id);       % Create
addchannel(ai,1);                   % Add channel             

%% Configure
% Set the analog input parameters
vFs = setverify(ai,'samplerate',Fs);   %Configure
set(ai,'samplespertrigger',vFs)  
      

%% Start
start(ai)

%% Read data
[data time] = getdata(ai);

%% Disconnect / Clean up
delete(ai)
clear ai  

%% Output data
daqOutput.data = data;
daqOutput.time = time;
daqOutput.sampleFrequency = vFs;

Contact us