mexPutVariable (Fortran)
Array from MEX function into specified workspace
Fortran Syntax
#include "fintrf.h" integer*4 mexPutVariable(workspace, varname, pm) character*(*) workspace, varname mwPointer pm
Arguments
workspaceSpecifies scope of the array you are copying. Values for
workspaceare:baseCopy
mxArrayto the base workspace.callerCopy
mxArrayto the caller workspace.globalCopy
mxArrayto the list of global variables.varnameName of
mxArrayin the workspacepmPointer to the
mxArray
Returns
0 on success; 1 on failure. A possible cause of
failure is that pm is 0.
Description
Call mexPutVariable to copy the mxArray, at
pointer pm, from your MEX function into the specified workspace.
MATLAB® software gives the name, varname, to the copied
mxArray in the receiving workspace.
mexPutVariable makes the array accessible to other entities, such as
MATLAB, user-defined functions, or other MEX functions.
If a variable of the same name exists in the specified workspace,
mexPutVariable overwrites the previous contents of the variable with
the contents of the new mxArray. For example, suppose the MATLAB workspace defines variable Peaches as:
Peaches 1 2 3 4
and you call mexPutVariable to copy Peaches into
the same workspace:
mexPutVariable("base", "Peaches", pm)The value passed by mexPutVariable replaces the old value of
Peaches.
Do not use MATLAB function names for variable names.
Common variable names that conflict with function names include i, j, mode, char, size, or path.
To determine whether a particular name is associated with a MATLAB function,
use the which function.
Version History
Introduced before R2006a