\matlab\extern\include\matrix.h(604) : error C2143: syntax error : missing ')' before 'constant',what happen to this ?
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
#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 comentarios
Respuestas (1)
James Tursa
el 29 de Jul. de 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 comentarios
Ver también
Categorías
Más información sobre Write C Functions Callable from MATLAB (MEX Files) en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!