00001 #include "stdlib.h"
00002 #include "stdio.h"
00003 
00004 #include "MFile.h"
00005 #include "kalman/ktypes.hpp"
00006 #include "kalman/kvector.hpp"
00007 #include "kalman/kmatrix.hpp"
00008 
00009 using namespace Kalman;
00010 using namespace std;
00011 
00012 int main()
00013 {
00014   MFile mfile;
00015   int i,j;
00016 
00017   KVector<double, 1, true> T, tmpVec;
00018   KMatrix<double, 1, true> ReperesX, tmpMat;
00019 
00020   
00021   selectKVectorContext(createKVectorContext(" ", "[ ", " ];", 4));
00022   selectKMatrixContext(createKMatrixContext(" ", " ;\n  ", "[ ", " ];", 4));
00023   mfile.read("test.m");
00024 
00025   mfile.print();
00026 
00027   mfile.get("T", T);
00028 
00029   mfile.get("ReperesX", ReperesX);
00030 
00031   cout<<T<<endl<<endl;
00032 
00033   cout<<ReperesX<<endl<<endl;
00034 
00035   tmpVec.resize(10);
00036 
00037   for(i=1; i<=10; i++)
00038     {
00039       tmpVec(i)=i;
00040     }
00041 
00042   tmpMat.resize(2,5);
00043 
00044   for(i=1; i<=2; i++)
00045     {
00046       for(j=1; j<=5; j++)
00047                 {
00048                   tmpMat(i,j)=i*5+j;
00049                 }
00050     }
00051 
00052   mfile.add("tmpVec", tmpVec);
00053 
00054   mfile.add("tmpVec2", tmpVec, COLUMN_VECTOR);
00055 
00056   mfile.add("tmpMat", tmpMat);
00057 
00058   mfile.print();
00059 
00060   mfile.save("test2.m");
00061 
00062   return 0;
00063 }