disp('Running...'); %1) Create a data acquistion object % (and specify single ended inputs) ai=analoginput('nidaq','Dev2'); ai.InputType='SingleEnded'; %2) Add channels 0 and 1 ch=addchannel(ai,0:1); %3) Change Properties to suit our needs ai.SampleRate=10; %Note sample rate may differ somewhat from specified rate. ai.SamplesPerTrigger=300; %4) Do acquisition start(ai) wait(ai,310); [y,t]=getdata(ai); %5) Clean up delete(ai); clear ai %6) Save Data (and plot) save myfile t y plot(t,y(:,1),t,y(:,2)) disp('Finished!');