Pointer in a C mex sfunction
이전 댓글 표시
Hello,
I have some problems to understand the syntax and the meaning of some pointers used in a C sfunction For example taken the output method of the TimesTwo sfunction
From which I reported an extract hereafter
Int_T i;
InputRealPtrsType uPtrs = ssGetInputPortRealSignalPtrs(S,0);
real_T *y = ssGetOutputPortRealSignal(S,0);
int_T width = ssGetOutputPortWidth(S,0);
for (i=0; i<width; i++) {
/*
* This example does not implement complex signal handling.
* To find out see an example about how to handle complex signal in
* S-function, see sdotproduct.c for details.
*/
*y++ = 2.0 *(*uPtrs[i]);
}
}
what is it supposed to mean *y++ (is the value to which the y pointer refers, isn't? but I'm wondering why there is the ++ notation following *y, I thought it's to point to the next memory area because we deal with a static vector). Am I right?
And what does it means (*uPtrs[i])? I thought it was the value of the variable to which the pointer points to.
is there anyone, who can help me to figure it out? can you suggest me some good references to understand how this stuff works?
thanks for reading
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Automotive Radar에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!