I am trying to develop an s-function block to get Joystick input in Simulink. While it seems pretty straight forward with mmsystem.h, now I got lots of nonsense samples between real values. I basically use S-Function Builder with no inputs and an output that has the values from joystick. I use continuous sample mode. I have the below code in my Outputs tab.
JOYINFOEX joyInfoEx;
joyGetPosEx(0, &joyInfoEx);
y0[0] = joyInfoEx.dwXpos;
y0[1]= joyInfoEx.dwYpos;
y0[2] = joyInfoEx.dwZpos;
y0[3] = joyInfoEx.dwRpos;
y0[4]= joyInfoEx.dwPOV;
My Continuous Derivatives and Discrete Update tabs are empty. But what I get when I run this s-fiction is something like below.
I ask for any ideas or experience to tackle this problem.