| Products & Services | Industries | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → MATLAB |
| Contents | Index |
| Learn more about MATLAB |
#include "engine.h"
int engPutVariable(Engine *ep, const char *name, const mxArray
*pm);
integer*4 engPutVariable(ep, name, pm) mwPointer ep, pm character*(*) name
0 if successful and 1 if an error occurs.
engPutVariable writes mxArray pm to the engine ep, giving it the variable name name. If the mxArray does not exist in the workspace, it is created. If an mxArray with the same name already exists in the workspace, the existing mxArray is replaced with the new mxArray.
The engine application owns the original mxArray and is responsible for freeing its memory. Although the engPutVariable function sends a copy of the mxArray to the MATLAB workspace, the engine application does not need to account for or free memory for the copy.
See engdemo.c in the matlabroot/extern/examples/eng_mat folder for sample programs that illustrate how to call the engine functions from a C program.
See engwindemo.c in the matlabroot/extern/examples/eng_mat folder for sample programs that illustrate how to call the engine functions from a C program for Windows systems.
[1] UNIX is a registered trademark of The Open Group in the United States and other countries.
![]() | engOutputBuffer (C and Fortran) | engSetVisible (C) | ![]() |

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 |