engGetMatrix, engPutMatrix

Purpose

Get and put Matrices into a MATLAB engine's workspace.

C Synopsis

#include "engine.h"
Matrix *engGetMatrix(ep,name)
  Engine *ep;
  char *name;
int engPutMatrix(ep,mp)
  Engine *ep;
  Matrix *mp;

Fortran Synopsis

integer*4 function engGetMatrix(ep,name)
integer*4 function engPutMatrix(ep,mp)
integer*4 mp, ep
character*(*) name

Arguments

ep
engine pointer
mp
Matrix pointer
name
name of Matrix to get from engine

Description

These routines allow you to put a Matrix into a MATLAB engine's workspace and to copy a Matrix out of the workspace.

engGetMatrix reads the named Matrix from the engine pointed to by ep and returns a pointer to a newly allocated Matrix structure, or NULL if the attempt fails.

engPutMatrix writes Matrix mp to the engine ep. If the Matrix does not exist in the workspace, it is created. If a Matrix with the same name already exists in the workspace, the existing Matrix is replaced with the new Matrix.

engPutMatrix returns 0 if successful and 1 if an error occurs.

Be careful in your code to free the Matrix created by this routine when you are finished with it.

On UNIX systems, engGetMatrix issues the command save stdio name to MATLAB, causing MATLAB to write the named Matrix down its stdout pipe, which is in turn caught and decoded by engGetMatrix. engPutMatrix issues the command load stdio name to MATLAB and sends the data down the stdin pipe.

On VMS systems, engGetMatrix uses input and output mailboxes to communicate with MATLAB.

Under MS-Windows on a PC, engGetMatrix communicates with MATLAB via DDE.

(c) Copyright 1994 by The MathWorks, Inc.