Home | Products | Software | Download | News | Search | F.A.Q. |        

Interfacing with 3rd party software - Matlab 6.5.1 and up

 
Matlab logo

All TiePie engineering measuring instruments can work in close collaboration with the MathWorks Matlab software. This provides the opportunity to perform instant processing on the acquired data, rather than first storing the measurements to disk, import them in Matlab and finally do your calculations.

Earlier versions of Matlab required a workaround to be able to use the DLL's supplied with the measuring instruments, but Matlab 6.5.1 and higher are able to import the DLL's directly. You can find the DLL for your measuring instrument in the download section.

Installation

To install the DLL for use with Matlab, make a directory on any hard drive, for example c:\tiepie, but make sure that you do not include spaces in the name. Copy the file tiepie.h and the DLL (eg. hs3.dll) to the directory that was just created. There are also 4 .hex files that were copied to your harddrive during the installation of you measuring instrument. These files will need to be copied to the Matlab folder in the $Matlab\Bin\Win32 subfolder, where $Matlab is your Matlab root folder.

Make sure that you install the same version of the DLL and the driver of your measuring instrument. Using different versions of the driver and the DLL may give unpredictable errors.

For the Handyscope HS3, a .m file is available to verify that your Handyscope HS3 works with Matlab. This .m file needs to be copied to the same directory as the DLL and the .h file. To execute the file, set the Current directory in Matlab to the directory where the .m file is located. In the Command window of Matlab, type hs3test and press 'enter'. The sample file should now be executed.

Matlab logo colourful

Using the TiePie engineering measuring instrument in Matlab

To use the measuring instrument in Matlab 6.5.1 or higher, the DLL first has to be loaded in Matlab. This can be done by typing:

loadlibrary( 'hs3', 'tiepie.h' );

This loads the functions as specified in the tiepie.h file from the DLL into Matlab. Matlab can now call these functions to communicate with the measuring instrument that is connected. To receive a list of the loaded functions, use:

libfunctions( 'hs3' )

The loaded functions can be used in Matlab by means of a library call, the calllib command in Matlab. Before any measurements can be performed, the instrument has to be initiated first. The calllib has to be used for this too:

calllib( 'hs3' , 'InitInstrument' , 0 )

Note that the library call is done without a semicolon. If an error occurs during initialisation, the InitInstrument function will return an error code. If '0' is returned, there are no errors and the hardware should be working correctly. Refer to the programmers manual for a list of the possible error codes.

print