I am trying to make an s-function block in matlab simulink.Here is the mdlOutput function.it gives me an error when i define local variables inside
//////
static void mdlOutputs(SimStruct *S, int_T tid)
{
real_T *y = ssGetOutputPortRealSignal(S,0);// no error
real_T *x = ssGetContStates(S);//no error
UNUSED_ARG(tid);
real_T *a;// error:missing ';' before 'type'
real_T *b=5.0//error: illegal use of this type as an expression
}
Not just real_T,I cannot define any type of local variables inside a function, other than the y and x that are already defined in the template.Using static variables at top is working fine.What could be the problem with normal variables?
I got it .I have to define variables before the UNUSED_ARG(tid) command