Products & Services Solutions Academia Support User Community Company

eml.wref - Pass argument by reference as write-only output

Syntax

[y =] eml.ceval('function_name', eml.wref(argO), ... un);

Arguments

argO

Variable passed by reference as a write-only output to the external C function called in eml.ceval.

Description

[y =] eml.ceval('function_name', eml.wref(argO), ... un); passes the variable argO by reference as a write-only output to the external C function called in eml.ceval. You add eml.wref inside eml.ceval as an argument to function_name. The argument list can contain multiple eml.wref constructs. Add a separate eml.wref construct for each write-only argument that you want to pass by reference to function_name.

Only use eml.wref in Embedded MATLAB code that you have compiled with emlmex or emlc. eml.wref generates an error in uncompiled M-code.

Example

In the following example, an Embedded MATLAB function fcn has a single input u and a single output y, a 5-by-10 matrix. fcn calls a C function init to initialize the matrix, passing y by reference as a write-only output. Here is the Embedded MATLAB function code:

function y = fcn(u)

y = zeros(5,10,'int8'); %Constrain output to an int8 matrix
eml.ceval('init', eml.wref(y));

The corresponding C function prototype looks like this:

void init(int8_T *x);

In this example:

See Also

eml.ceval, eml.ref, eml.rref

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS