Newer
Older
/* test.cc
Copyright (C) 1999-2004 University of Oxford */
/* CCOPYRIGHT */
#include "miscmaths/miscmaths.h"
#include "miscmaths/miscprob.h"
#include "utils/options.h"
#include <vector>
using namespace MISCPLOT;
using namespace MISCMATHS;
using namespace Utilities;
using namespace std;
// The two strings below specify the title and example usage that is
// printed out as the help or usage message
string title="test (Version 1.0)\nCopyright(c) 2007, University of Oxford (Christian F. Beckmann)";
string examples="test int";
Option<bool> help(string("--help"), false,
string(" display this message"),
false, no_argument);
Option<int> num(string("--num"), 1,
string("number of iterations"),
false, requires_argument);
int nonoptarg;
////////////////////////////////////////////////////////////////////////////
// Local functions
int do_work(int argc, char* argv[])
Matrix mat;
cout << "BLAH " << num.value() << endl;
mat=normrnd(300,1);
miscplot::Timeseries(mat.t(),string("test0.png"),string("TEST"));
for (int i=1; i <= (int)num.value();i++){
miscplot newplot;
newplot.GDCglobals_set();
mat = normrnd(300,3)+2;
Matrix col;
col = mat;
newplot.add_bpdata(col);
// newplot.add_bpdata(col);
newplot.boxplot(string("test")+num2str(i)+string(".png"),string("TEST"));
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
////////////////////////////////////////////////////////////////////////////
int main(int argc,char *argv[])
{
Tracer tr("main");
OptionParser options(title, examples);
try {
// must include all wanted options here (the order determines how
// the help message is printed)
options.add(help);
options.add(num);
options.parse_command_line(argc, argv);
// line below stops the program if the help was requested or
// a compulsory option was not set
if ( (help.value()) || (!options.check_compulsory_arguments(true)) )
{
options.usage();
exit(EXIT_FAILURE);
}
} catch(X_OptionError& e) {
options.usage();
cerr << endl << e.what() << endl;
exit(EXIT_FAILURE);
} catch(std::exception &e) {
cerr << e.what() << endl;
}
// Call the local functions
return do_work(argc,argv);
}