using MEX file and constants

3 次查看(过去 30 天)
Hello,
I need to use PI value inside the mex file. how should i do it? (because right now I'm getting an error): Error GMSK_viterbi.c: 66 undeclared identifier `PI'

采纳的回答

James Tursa
James Tursa 2013-9-27
编辑:James Tursa 2013-9-27
One way:
#include <math.h>
Then use M_PI for the value in your code instead of PI, or you could add this line also:
#define PI M_PI
Another way:
#define PI 3.1415926535897932
One could also use compile option -D to get it defined.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Write C Functions Callable from MATLAB (MEX Files) 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by