Main Page   Compound List   File List   Compound Members   File Members  

fits_write_header.c

Go to the documentation of this file.
00001 
00028 #include <string.h>
00029 #include <stdio.h>
00030 #include <fitsio.h>
00031 #include <malloc.h>
00032 
00033 #include "mex.h"
00034 #include "matrix.h"
00035 #include "mfitsio.h"
00036 
00047 void
00048 mexFunction (int nlhs, mxArray * plhs[], int nrhs, const mxArray * prhs[])
00049 {
00050   int buflen, status;
00051   char *filename;
00052   mfitsio_header *header;
00053   mfitsio_info *info;
00054   mxArray *headerm = 0;
00055   mxArray *img = 0;
00056 
00057   /* Check proper input and output */
00058   if (nrhs != 2)
00059     mexErrMsgTxt ("Exactly two inputs required.");
00060   else if (nlhs > 0)
00061     mexErrMsgTxt ("Too many output arguments.");
00062   else if (!mxIsChar (prhs[0]))
00063     mexErrMsgTxt ("Input must be a string (filename).");
00064 
00065   if (mxGetM (prhs[0]) != 1)
00066     mexErrMsgTxt ("Input must be a row vector string (filename).");
00067 
00068   buflen = (mxGetM (prhs[0]) * mxGetN (prhs[0])) + 1;
00069 
00070   filename = mxCalloc (buflen, sizeof (char));
00071   status = mxGetString (prhs[0], filename, buflen);
00072 
00073   headerm = (mxArray *) prhs[1];
00074   if (mxGetClassID (headerm) != mxSTRUCT_CLASS)
00075   {
00076     mexErrMsgTxt ("The header must be a 1x1 struct array.");
00077   }
00078   mfitsio_write_header (filename, headerm);
00079 
00080   return;
00081 }


Operated by University of California for the National Nuclear Security Administration of the US Department of Energy. Copyright © 2002-2003 UC | Disclaimer/Privacy
This website has been approved for unlimited release with associated LA-UR number LA-UR-03-0949.