\matlab\extern\include\matrix.h(604) : error C2143: syntax error : missing ')' before 'constant',what happen to this ?
10 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
#include <iostream>
#include <fstream>
#include <cstring>
#define pi 3.1415926
#define g 9.8065
#define sigma 75
#define delroe 9.80675e2
#define H0 -6.05
#define step 0.0000008
#include "sline.h"
#include <vector>
#include "mex.h"
#include <cmath>
using namespace std;
void thetap(Sline & snplus, Sline & sn){
double a;
a =0.5*delroe*g*sn.endy()/sigma;
snplus.setangle(sn.angle() + (a + H0)*sn.dis());
snplus.setstx(sn.endx());
snplus.setsty(sn.endy());
}
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, mxArray *prhs[]){
Sline init(0, step, 0, 0);
vector<Sline> a(1);
a[0] = init;
double ang = mxGetScalar(prhs[0]);
do{
Sline *c = new Sline;
c->setdis(step);
a.push_back(*c);
thetap(*(a.end() - 1), *(a.end() - 2));
} while ((a.end() - 1)->angle() * 180.00 / pi > ang);
auto m = a.size();
plhs[0] = mxCreateDoubleMatrix(int(m), 1, mxREAL);
plhs[1] = mxCreateDoubleMatrix(int(m), 1, mxREAL);
double *outdataone = mxGetPr(plhs[0]);
double *outdatatwo = mxGetPr(plhs[1]);
for (int i = 0; i < int(m); i++)
{
outdataone[i] = a[i].startx();
outdatatwo[i] = a[i].starty();
}
}
0 Kommentare
Antworten (1)
James Tursa
am 29 Jul. 2016
Can you compile a bare bones file? E.g.,
#include "mex.h"
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, mxArray *prhs[]){
}
If so, maybe something in your other files is clobbering something in the mex header files. Try moving the #include "mex.h" to the front of the file.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Write C Functions Callable from MATLAB (MEX Files) finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!