I2C SPI USB CAN eSPI Cable Testing View All Videos Quick Start Guides Software Downloads App Notes White Papers User Manuals Knowledge Base Sales Support About Us
Products Blog Sales Support Contact Search
How To Use Total Phase Products With MATLAB
How To Use Total Phase Products With MATLAB

Introduction

This knowledge base article is intended to provide guidelines for using Total Phase products with Matlab.

Overview

Total Phase products support multiple operation systems including Windows, Linux, and Mac, and support multiple languages including C, C#, Python, and VB with examples. Currently, the API package does not include Matlab drivers, but the user can easily create them.

This article provides detailed guidelines for using the Aardvark adapter with Matlab. For using one of the other Total Phase products with Matlab, the guidelines are similar, and Aardvark adapter and its files are needed to be replaced with the relevant product appropriately.

Using Aardvark Adapter and Matlab Guidelines

  1. Download and run the latest version of the Total Phase USB Drivers Installer.
  2. Download and unzip the latest version of Aardvark adapter API. (?)
  3. Go the c directory in the Aardvark API package.
  4. Modify the functions' names in aardvark.h file.
    1. Perform on aardvark.h file a search and replace in order to rename all functions to have a "c_" prefix. (The Aardvark API functions are not exposed from aardvark.dll with the names listed in the user manual. The aardvark.c source file acts as a wrapper for the dll functions to the API functions which all have the prefix "c_". Those functions' names are exported public. So, aardvark.dll has functions called "c_aa_open" instead of "aa_open" as seen in aardvark.h.  This name modification ensures that the dll and h files match).
  5. Run the Mathworks loadlibrary command. (?)
    1. Call loadlibrary('aardvark.dll',['aardvark.h'],'mfilename','aardvark_matlab'). (The Mathworks loadlibrary command takes c header file and creates m wrapper instead. This command creates a file called aardvark_matlab.m).
  6. Continue with the programing based on the system requirements.

Notes

For additional information, take a look at the Aardvark adapter API documentation, and the loadlibrary command in the Matlab help documentation.