image thumbnail

LabJackU3

version 1.0.0.0 (4.66 KB) by Nathan Tomlin
This function simplifies talking to a labjack U3.

900 Downloads

Updated 12 May 2010

View License

Must have MATLAB_LJUD.zip file from
http://labjack.com/support/ud/examples/matlab
and 'LJUD_Functions' folder must be on path or in the current directory

inputs:
op operation to perform, options are:
temperature - read internal temp in Kelvin
AnalogIn,N
read single-ended analog input from channel N
AnalogInDiff,N1,N2
read differential analog input from channels: N1-N2
AnalogOut,N1,N2
set analog output channel N1 (0 or 1) to voltage N2
DigitalIn,N - read 0 or 1 on channel N
DigitalOut,N1,N2
set channel N1 to digital value N2 (0 or 1)
StreamAnalogIn,N1,N2,N3
stream from channel N1 (can be array of multiple channels) at rate N2 samples/sec for total of N3 seconds

varargin - currently no options

examples:
T = LabJackU3('temperature')
% return internal temperature
V2 = LabJackU3('AnalogIn',2)
% return AIN2-GND voltage
V6to5 = LabJackU3('AnalogInDiff',6,5)
% return AIN6-AIN5 voltage
LabJackU3('AnalogOut',1,3)
% set DAC1 to 3 volts
D4 = LabJackU3('DigitalIn',4)
% read voltage of 0 or 1 on FIO4
LabJackU3('DigitalOut',5)
% set voltage to 0 or 1 on FIO5
[time,V1]=LabJackU3('StreamAnalogIn',1,1000,.3);
% stream AIN1 at 1000 Hz for 0.3 seconds
[time,Vs]=LabJackU3('StreamAnalogIn',[0,1],5000,1.5);
% stream both AIN0 & AIN1 at 5000 Hz for 1.5 seconds

Cite As

Nathan Tomlin (2021). LabJackU3 (https://www.mathworks.com/matlabcentral/fileexchange/27597-labjacku3), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2007a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!