# mexGetFull, mexPutFull

## Purpose

Easier way to get and put full Matrices into a workspace.

## C Synopsis

    #include "mex.h"
    int mexGetFull(name,m,n,pr,pi)
      char *name;
      int *m;
      int *n;
      double **pr;
      double **pi;
    int mexPutFull(name,m,n,pr,pi)
      char *name;
      int m;
      int n;
      double *pr;
      double *pi;

## Fortran Synopsis

    integer*4 function mexGetFull(name,m,n,pr,pi)
    integer*4 function mexPutFull(name,m,n,pr,pi)
    integer*4 m,n,pr,pi
    character*(*) name

## Arguments

`m`
  row dimension
`n`
  column dimension
`name`
  name of Matrix to get or put into workspace
`pi`
  pointer to imaginary part
`pr`
  pointer to real part

## Description

Most MATLAB applications work only with full (nonsparse) Matrices. These routines provide an easy way to write a full Matrix into a MEX-file's caller's workspace and to copy a full Matrix out. They offer an alternative to `mexGetMatrix` and `mexPutMatrix`, which do not require use of the Matrix structure.

`mexGetFull` reads the named Matrix from the caller's workspace and places the row dimensions, column dimensions, real array pointer, and imaginary array pointer into the locations specified by `m`, `n`, `pr`, and `pi`, respectively.``

`mexGetFull` returns 0 if successful, and 1 otherwise.

`mexGetFull` allocates memory for the real and imaginary arrays using `mxCalloc`; use `mxFree` to return it when you are done.

If the Matrix is purely real, the imaginary pointer is given `NULL`.

`mexPutFull` writes the Matrix with dimensions `m`-by-`n`, real data `pr`, and imaginary data `pi` into the calling workspace with the specified `name`.

If the Matrix does not exist in the calling function's 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.

(c) Copyright 1994 by The MathWorks, Inc.