Re: C MEX S-Function Builder
- From: "Praetorian" <ashish.sadanandan@xxxxxxxxx>
- Date: 14 Sep 2006 07:52:28 -0700
Hello Ashish,
Many thanks for your reply.I also do not understand what is going
wrong and about to go mad really. Anyway, i tried to use union once
more:
Just before initialization function,
typedef union { uint8_T uvalue[8];
real_T d;
} UnionNum;
static void mdlOutputs(SimStruct *S, int_T tid)
{
int_T i;
int_T width = ssGetOutputPortWidth(S,0);
InputPtrsType uPtrs = ssGetInputPortSignalPtrs(S,0);
uint8_T *y = (uint8_T *)ssGetOutputPortSignal(S,0);
UnionNum num;
num.d = uPtrs ;
This is incorrect, the assignment shoult be:
num.d = *uPtrs[0];
uPtrs is a pointer to a pointer to the input so you cannot assign it
directly to a double.
Also try adding this line for debugging:
ssPrintf("sizeof union = %d\n",sizeof(num));
If the value printed is greater than 8 that means your machine doesn't
support a uint8s and so uint8_T is actually something larger. In that
case you'll have to do some bitwise AND and shifting math to get your
result.
for(i=0; i<width; i++)
{
y[i] = num.uvalue[i];
}
}
This time it gives me this error message :
>> mex double2integer.c
Error double2integer.c: 79 operands of = have illegal types `double'
and `pointer to const pointer to const void'
Why does it have problem with 'double'? Do you see anything to
correct here? I appreciate your help again. Thank you.
Regards,
Cahit
HTH,
Ashish.
.
- References:
- Re: C MEX S-Function Builder
- From: Praetorian
- Re: C MEX S-Function Builder
- From: Cahit
- Re: C MEX S-Function Builder
- From: Praetorian
- Re: C MEX S-Function Builder
- From: Cahit
- Re: C MEX S-Function Builder
- From: Praetorian
- Re: C MEX S-Function Builder
- From: Cahit
- Re: C MEX S-Function Builder
- Prev by Date: Re: vectorize
- Next by Date: Re: trouble installing Matlab on Fedora Linux - pl
- Previous by thread: Re: C MEX S-Function Builder
- Next by thread: Matlab and GCC 4.4.1
- Index(es):
Relevant Pages
|
Loading