The Matlab LibTiePie package creates easy to use objects in Matlab to control the instruments.
The MatlabLibTiePie package download contains a directory named +LibTiePie, with all required files in a specific directory structure. The parent directory of the +LibTiePie directory must be in the Matlab path (or must be the current directory).
To install the MatlabLibTiePie bindings for LibTiePie on Windows, first ensure that LibTiePie is installed.
- For 64 bit Matlab installations use the 64 bit version of LibTiePie
- For 32 bit Matlab installations use the 32 bit version of LibTiePie
To install MatlabLibTiePie, create a directory structure such as C:\TiePie\+LibTiePie. To temporarily add C:\TiePie to the Matlab path, execute addpath C:\TiePie. To permanently add C:\TiePie to the Matlab path, use , or in Matlab 2012b+'s ribbon menu .
libtiepie.dll (or .so), libtiepie.h and libtiepiematlab.h must also be in the Matlab path. You can copy them to the C:\TiePie directory already added to the Matlab path.
To install the MatlabLibTiePie bindings for LibTiePie on Linux, first ensure that LibTiePie is installed.
To install MatlabLibTiePie copy the +LibTiePie directory to ~/Documents/MATLAB/ (By default ~/Documents/MATLAB/ is in the Matlab path).
LibTiePie may require a newer version of the GNU C++ library than is provided by Matlab. In that case, loading the library using LibTiePie = LibTiePie.Library Matlab will report an error like:
There was an error loading the library "libtiepie" /usr/local/MATLAB/R2012b/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6: version 'GLIBCXX_3.4.15' not found (required by /usr/lib/libtiepie.so)
This can be solved by letting Matlab use the systems GNU C++ library by:
- cd /usr/local/MATLAB/R<release>/sys/os/glnxa64
- sudo unlink libstdc++.so.6
C compiler for Matlab
In order to use LibTiePie, Matlab requires a C compiler. For 32 bit versions of Matlab for Windows platforms default a C compiler is installed along with Matlab. 64 bit versions of Matlab for Windows platforms and Matlab versions for Linux and OS X platforms are not supplied with a C compiler. When no suitable compiler is installed, Matlab will produce an error like:
Error using loadlibrary (line 254) A 'Selected' compiler was not found. You may need to run mex -setup.
This can be solved by installing a suitable compiler. More information can be found on the Matlab Supported and Compatible Compilers page.
It is recommended to import the enumerated constants for LibTiePie to be able to use them for example as MM.STREAM instead of LibTiePie.Enum.MM.STREAM. You can do this by executing: import LibTiePie.Enum.*
Now you can open the library as follows: LibTiePie = LibTiePie.Library
Search for devices: LibTiePie.DeviceList.update()
Open the first oscilloscope: scp = LibTiePie.DeviceList.getItemByIndex(0).openOscilloscope()
Open the first function generator: gen = LibTiePie.DeviceList.getItemByIndex(0).openGenerator()
Matlab will show which properties and methods can be used on each object.
List of available example scripts:
- Generator example
- Arbitrary waveform generator example
- Generator burst example
- Generator gated burst example
- Generator triggered burst example
- I2C DAC example
- Device list example
- Oscilloscope example
- Oscilloscope segmented trigger example
- HS3/HS4 combined oscilloscope example
- SureConnect oscilloscope example
- Oscilloscope triggered by generator example
- Oscilloscope streaming data example