using MEX file and constants

조회 수: 1 (최근 30일)
michael
michael 2013년 9월 27일
편집: James Tursa 2013년 9월 27일
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