00001 #ifndef vnl_matlab_filewrite_h_
00002 #define vnl_matlab_filewrite_h_
00003
00004
00005
00006
00007
00008
00009
00010
00011
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
00024
00025
00026
00027 class vnl_matlab_filewrite {
00028 public:
00029 vnl_matlab_filewrite (char const* file_name, char const *basename = 0);
00030
00031
00032
00033
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_