SYNOPSIS

#include "matlab.h" MAT *m_load(FILE *fp, char **name) MAT *m_save(FILE *fp, MAT *A, char *name) VEC *v_save(FILE *fp, VEC *x, char *name) double d_save(FILE *fp, double d, char *name)

#include "matlab.h" ZMAT *zm_load(FILE *fp, char **name) ZMAT *zm_save(FILE *fp, ZMAT *A, char *name) ZVEC *zv_save(FILE *fp, ZVEC *x, char *name) complex z_save (FILE *fp, complex z, char *name)

DESCRIPTION

These routines read and write MATLAB\TM\ load/save files.
This enables results to be transported between MATLAB and Meschach.
The routine `m_load()` loads in a matrix from file `fp`
in MATLAB save format.
The matrix read from the file is returned, and `name` is set to point
to the saved MATLAB variable name of the matrix.
Both the matrix returned and `name` have allocated memory as needed.
An example of the use of the routine to load a matrix `A` and a vector
`x` is

MAT *A, *Xmat; VEC *x; FILE *fp; char *name1, *name2; ...... if ( (fp=fopen("fred.mat","r")) != NULL ) { A = m_load(fp,&name1); Xmat = m_load(fp,&name2); if ( Xmat->n != 1 ) { printf("Incorrect size matrix read in\n"); exit(0); } x = v_get(Xmat->m); x = mv_move(Xmat,0,0,Xmat->m,1,x,0); }The

#define MACH_ID INTEL /* 80x87 format */ #define MACH_ID MOTOROLA /* 6888x format */ #define MACH_ID VAX_D /* VAX D format */ #define MACH_ID VAX_G /* VAX G format */to be the appropriate machine. The machine dependence involves both whether IEEE or non IEEE format floating point numbers are used, but also whether or not the machine is a ``little-endian'' or a ``big-endian'' machine.

BUGS

The `m_load()` routine will only read in the real part of a complex
matrix.
The routines are machine-dependent as described above.

SOURCE FILE: `matlab.c, zmatlab.c`