Using LabJack with MATLAB on Linux | LabJack
 

Using LabJack with MATLAB on Linux

3 posts / 0 new
Last post
Wuffi
Wuffi's picture
Using LabJack with MATLAB on Linux

Hello everybody out there using LabJack,

There are excellent instructions on how to use LabJack with MATLAB on Windows, but I would not know how to connect my LabJacks (U12 and U3) to MATLAB on Linux. Both are working perfectly with Python on Linux.

To be honest, I also have trouble accessing my LabJack U12 from MATLAB (2018R). When I call the function daq.getVendors(), LabJack is not listed (only another vendor).

LabJack Support
labjack support's picture
We only provide MATLAB

We only provide MATLAB interfaces/examples on Windows. You can access our Linux libraries/APIs through MATLAB on Linux but we have no downloads or instructions for it.

In general, to access a library on Linux in MATLAB there are the loadlibrary and calllib functions. Here are MATLAB functions for directly calling C library functions:

https://www.mathworks.com/help/matlab/call-c-library-functions.html

As for our Linux libraries, for the U12 there is the ljacklm:

https://labjack.com/support/software/installers/u12/u12-mac-and-linux-lj...

For the U3, there is the Exodriver:

https://labjack.com/support/software/installers/exodriver

Note that the Exodriver is a low-level USB library and does not provide high-level function as the UD library which is Windows only. Our newer DAQ series, the T-Series (T7 and T4), have a high-level library for Linux which is easier to use, but also does not have a MATLAB interface/examples.

For the U3, there is a third-party MATLAB class from the Opticka project that may have the functionality you need, or at least give you a starting point for adding new functionality:

https://github.com/iandol/opticka/blob/master/communication/labJack.m

As for daq.getVendors, there is no LabJack support in the data acquisition toolbox provided by MathWorks, so MATLAB "daq" functionality will not work with our LabJack DAQs.

Wuffi
Wuffi's picture
Thanks a lot for your quick

Thanks a lot for your quick and comprehensive answer, which helps me a lot. Especially the hint on the Opticka project is interesting.

I'm very happy about LabJack's excellent Python bindings, because this is very portable and accessible and therefore prioriy for me.