Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

vnl_matlab_filewrite.h

Go to the documentation of this file.
00001 #ifndef vnl_matlab_filewrite_h_
00002 #define vnl_matlab_filewrite_h_
00003 
00004 // This is vxl/vnl/vnl_matlab_filewrite.h
00005 
00006 //: \file
00007 //  \brief 
00008 //  \author David Capel, Oxford RRG, 17 August 1998
00009 
00010 // Modifications
00011 // LSB (Manchester) 23/3/01  Tidied documentation
00012 
00013 
00014 
00015 #include <vcl_string.h>
00016 #include <vcl_iostream.h>
00017 #include <vcl_fstream.h>
00018 #include <vcl_complex.h>
00019 
00020 #include <vnl/vnl_vector.h>
00021 #include <vnl/vnl_matrix.h>
00022 
00023 //: Code to perform MATLAB binary file operations
00024 //    vnl_matlab_filewrite is a collection of I/O functions for reading/writing
00025 //    matrices in the compact MATLAB binary format (.mat)
00026 
00027 class vnl_matlab_filewrite {
00028 public:
00029   vnl_matlab_filewrite (char const* file_name, char const *basename = 0);
00030 
00031   //: Add scalar/vector/matrix variable to the MAT file using specified
00032   // variable name. If no name is given, variables will be generated by
00033   // appending 0,1,2 etc to the given basename.
00034   void write(double v, char const* variable_name = 0);
00035 
00036   void write(vnl_vector<double> const & v, char const* variable_name = 0);
00037   void write(vnl_vector<vcl_complex<double> > const & v, char const* variable_name = 0);
00038 
00039   void write(vnl_matrix<float> const & M, char const* variable_name = 0);
00040   void write(vnl_matrix<double> const & M, char const* variable_name = 0);
00041   void write(vnl_matrix<vcl_complex<float> > const & M, char const* variable_name = 0);
00042   void write(vnl_matrix<vcl_complex<double> > const & M, char const* variable_name = 0);
00043 
00044   void write(double const * const *M, int rows, int cols, char const* variable_name = 0);
00045 
00046 protected:
00047   vcl_string basename_;
00048   int variable_int_;
00049   vcl_fstream out_;
00050 
00051   vcl_string make_var_name(char const* variable_name);
00052 };
00053 
00054 #endif // vnl_matlab_filewrite_h_

Generated at Fri May 21 01:15:48 2004 for ITK by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2000