This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


Build adaptor for third-party data acquisition interface


script = daq.sdk.utility.mex.buildAdaptor(___)



daq.sdk.utility.mex.buildAdaptor(adaptorName,customFunc,srcPath,outputPath) builds an adaptor for enumerating, configuring, and streaming data to and from a data acquisition device driver.


This function requires that your system is configured with Microsoft® Visual Studio® 2013 or later.


daq.sdk.utility.mex.buildAdaptor(adaptorName,customFunc,srcPath,outputPath,vendorLib) allows you to specify a custom library for the build.


script = daq.sdk.utility.mex.buildAdaptor(___) returns the script used for the build. This can be useful for diagnostic purposes.


collapse all

Build the custom adaptor named MyAdaptor.

daq.sdk.utility.mex.buildAdaptor('MyAdaptor','custom_my', ...

Build the custom adaptor and return the build script.

scr = daq.sdk.utility.mex.buildAdaptor('MyAdaptor','custom_my', ...
scr =

    'mex 'C:\adaptors\daqsdk\src\daqadaptor\MyAdaptor\Shared\dispatcher.cpp' 
-I'C:\Program Files\MATLAB\R2017\toolbox\daq\daqsdk\src\daqadaptor\Shared' 
-I'C:\Program Files\MATLAB\R2017\toolbox\daq\daqsdk\src\include' 
-I'C:\adaptors\daqsdk\src\daqadaptor\MyAdaptor' -DADAPTOR=MyAdaptor 
-DDAQADAPTOR_EXPORT -DINT16_MIN=-32768 -DINT16_MAX=32767 -output MyAdaptor 
-outdir 'C:\adaptors\daqsdk\bin\win64' -v -g COMPFLAGS='$COMPFLAGS -W3' 
CXXFLAGS='$CXXFLAGS -std=c++11''

You can save this script to a file and further modify it. You can run your modified script with eval or daq.sdk.utility.mex.runBuildScript. For syntax options, type

help daq.sdk.utility.mex.runBuildScript

Use the custom library MyLibrary for building an adaptor.

pathToHeaderAndLib = 'C:\libraries\MyLibrary'
myLibrary.HeaderPath = fullfile(pathToHeaderAndLib,'include');
myLibrary.LibPath = fullfile(pathToHeaderAndLib,'lib');
myLibrary.LibName = 'MyLibrary';


Input Arguments

collapse all

Name of the adaptor, specified as a character vector or string.

Example: 'DemoAdaptor'

Data Types: char | string

Name of the file containing the source code for custom functions, specified as a character vector or string. The file must be in the folder identified by srcPath.

Example: 'custom_demo.cpp'

Data Types: char | string

Path to adaptor source folder, specified as a character vector or string.

Example: 'c:\temp\sdk\daqadaptor'

Data Types: char | string

Path to generated adaptor MEX-file location, specified as a character vector or string.

Example: 'c:\temp\sdk\bin\win64'

Data Types: char | string

Vendor library locations, specified as a structure containing these three fields:

  • HeaderPath — a character vector specifying the path to the vendor header.

  • LibPat — a character vector specifying the path to the vendor static library.

  • LibName — a character vector specifying the name of the static library, without file extension.

Data Types: struct

Output Arguments

collapse all

Build script returned as a character vector. This script indicates what the function ran to build the adaptor.

Introduced in R2017a