Automatic Generation of Inputs Information for MATLAB Coder

Centre de Recherche en Informatique (CRI)

MINES ParisTech - PSL

(claude.tadonki@mines-paristech.fr)

Introduction

MATLAB Coder indded enables users to get C/C++/Mex version of their MATLAB routines. However, and this makes sense, we
assert(isa(col,'double')); assert(all(size(col) >= [1000 1])); assert(all(size(col) <= [2000 1]));

The above line says that variable If you have lot of inputs including complex structures, then the task becomes tedious. Indeed, for a structure (type

Once you get all the information, then you need to write the corresponding lines as previously shown. Its gives something like this

function [pts, nb_pts] = Compute(lig, col) %#codegen assert(isa(lig,'double')); assert(all(size(lig) >= [1000 1]));assert(all(size(lig) <= [2000 1])) assert(isa(col,'double')); assert(all(size(col) >= [1000 1]));assert(all(size(col) <= [2000 1])); ...

Tool for automatic generation

Here we provide a tool that will snoop your routine, collect/compute all required information and generate the Dowload the code here and copy into your working directory (please, reference this page when using the tool).

The main steps to use it are the followings:

f Consider a matlab function Outputs = MyFunction(Inputs_List) % 1. Add the following line just below the header of the function % T = GenDataAssert('','',Inputs_List); % 2. Delete (if exists) the file InputForMatlabCoder.txt % 2. Run you code as usual (it will be slower because of file operations) % 3. The result is in the file InputForMatlabCoder.txt (you could look at the text form in T) % 4. Just copy the content of the previous file below the #codegen pragma % 5. Run MATLAB Coder for code generation