Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.



Calculating remainder (modulus) in C Mex S Function
Posted:
Feb 21, 2013 8:04 AM


I'm having problem in converting data type within C Mex S function. I would like to calculate the modulus of a real_T data type. if I calculate remainder using C language format i.e., (input%5) in C Mex S function, then I get errors in compiling mex function. Can anyone of you help me how to calculate the remainder operator in the Cmex S Function?
My code looks like this
real_T data; real_T Sample_Length = 120; int_T counter; counter = 0; if (data%Sample_Length==0) { counter= counter +1; }
Or is there any other way I can realize this modulus operator?
Saif



