mexGetVariablePtr (C and Fortran) - Get read-only pointer to variable from another workspace

C Syntax

#include "mex.h"
const mxArray *mexGetVariablePtr(const char *workspace, 
  const char *varname);

Fortran Syntax

mwPointer mexGetVariablePtr(workspace, varname)
character*(*) workspace, varname

Arguments

workspace

Specifies which workspace you want mexGetVariablePtr to search. The possible values are

base

Search for the variable in the base workspace.

caller

Search for the variable in the caller's workspace.

global

Search for the variable in the global workspace.

varname

Name of a variable in another workspace. This is a variable name, not an mxArray pointer.

Returns

A read-only pointer to the mxArray on success. Returns NULL in C (0 in Fortran) on failure.

Description

Call mexGetVariablePtr to get a read-only pointer to the specified variable, varname, into your MEX-file's workspace. This command is useful for examining an mxArray's data and characteristics. If you need to change data or characteristics, use mexGetVariable (along with mexPutVariable) instead of mexGetVariablePtr.

If you simply need to examine data or characteristics, mexGetVariablePtr offers superior performance because the caller needs to pass only a pointer to the array.

C Examples

See mxislogical.c in the mx subdirectory of the examples directory.

See Also

mexGetVariable

  


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