External Interfaces Reference Previous page   Next Page
mexPutVariable

Copy mxArray into specified workspace

Fortran Syntax

Arguments

workspace
   Specifies the scope of the array that you are copying. The possible values are:

base
Copy the mxArray to the base workspace
caller
Copy the mxArray to the caller's workspace
global
Copy the mxArray to the list of global variables

varname
   Name given to the mxArray in the workspace.

pm
   Pointer to an mxArray.

Returns

0 on success; 1 on failure. A possible cause of failure is that the pm argument is zero.

Description

Call mexPutVariable to copy the mxArray, at pointer pm, from your MEX-file into the specified workspace. MATLAB gives the name, varname, to the copied mxArray in the receiving workspace.

mexPutVariable makes the array accessible to other entities, such as MATLAB, M-files or other MEX-files.

If a variable of the same name already 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

and you call mexPutVariable to copy Peaches into the MATLAB workspace.

Then the old value of Peaches disappears and is replaced by the value passed in by mexPutVariable.

See Also

mexGetVariable


Previous page  mexPutMatrix (Obsolete) mexSetTrapFlag Next page

© 1994-2005 The MathWorks, Inc.