Plot from C Mex function and C types
이전 댓글 표시
Hello,
I'am writing an S-function in C and I need at some point to plot the content of DWork vectors (the first Dwork vector being the x-axis and the second the y-axis).
I tried the following:
mexCallMATLAB(0,x,1,y,"plot");
However this doesn't work because x and y are not of type mxArray but REAL T. Indeed this is how x and y are defined:
real_T *x = (real_T*) ssGetDWork(S,0);
real_T *y = (real_T*) ssGetDWork(S,1);
It is not possible to change the type of x and y. Is it possible to copy the content of x and y in a mxArray so that the function mexCallMATLAB can be used? I am not really an expert in C, so hopefully it won't be too hard to implement :o
Besides, is it possible to save the content of a Dwork vector (or a mxArray once "converted") in the Matlab workspace ?
Thanks.
채택된 답변
추가 답변 (1개)
Alex
2013년 8월 21일
0 개 추천
댓글 수: 1
Kaustubha Govind
2013년 8월 21일
FYI, there is also a run-time API (see Access Block Data During Simulation) that you can use to attach a listener to the block Output method that can read Discrete State data.
카테고리
도움말 센터 및 File Exchange에서 Configure C/C++ S-Function Features에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!