You can convert the command line string arguments to double using the atof()
function from stdlib.h
. As I see you are using the TCHAR
equivalents, there is a macro that wraps the correct call for UNICODE
and ANSI
builds, so you can do something like this (assuming your command line arguments are in the correct order)
#include "stdafx.h"
#include "shoes_sharedlibrary.h"
#include <iostream>
#include <string.h>
#include "mex.h"
#include <stdlib.h>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
// ... initial code
// convert command line arguments to doubles ...
double wt1 = _tstof(argv[1]);
mwArray C(wt1);
double wt2 = _tstof(argv[2]);
mwArray F(wt2);
double wt3 = _tstof(argv[3]);
mwArray T(wt3);
// ... and so on ....
}
Note that argv[0]
will contain the name of your program as specified on the command line, so the arguments begin at argv[1]
. Then your command line can be something like:
yourprog.exe 0.123 0.246 0.567 etc.