Tutorial by Examples

In this example we will write a basic program that checks the number of inputs and outputs passed to a MEX-function. As a starting point, we need to create a C++ file implementing the "MEX gateway". This is the function executed when the file is called from MATLAB. testinputs.cpp // Mat...
In this example, we illustrate string manipulation in MATLAB MEX. We will create a MEX-function that accepts a string as input from MATLAB, copy the data into C-string, modify it and convert it back to mxArray returned to the MATLAB side. The main objective of this example is to show how strings ca...
In this example we illustrate how to take a double real-type 3D matrix from MATLAB, and pass it to a C double* array. The main objectives of this example are showing how to obtain data from MATLAB MEX arrays and to highlight some small details in matrix storage and handling. matrixIn.cpp #include...
This example illustrates how to read various-type struct entries from MATLAB, and pass it to C equivalent type variables. While it is possible and easy to figure out from the example how to load fields by numbers, it is here achieved via comparing the field names to strings. Thus the struct fields ...

Page 1 of 1