Re: compile C S-Function which uses MEX calls with RTW
- From: riccardo <nothx@xxxxxxxxxx>
- Date: Wed, 18 Jul 2007 05:32:16 -0400
Titus wrote:
structure
"riccardo" <nothx@xxxxxxxxxx> schrieb im Newsbeitrag
news:ef5dc10.0@xxxxxxxxxxxxxxxxxxxxxxxxxx
Titus wrote:
Hi Bert,
you are (unfortunately) right, RTW does not support
thearguments to
S-functions.
For the second question: first of all, do you really need
instead ofinverse or are
you solving some
system of linear equations. In the latter case, use \
MATLABinv (in
MATLAB). And: no,
you don't need to code this your self, use the Embedded
which IfunctionNewsbeitrag
block for
this kind of problems.
Titus
"Bert " <bert.vandersmissen@xxxxxxxxxxxx> schrieb im
news:f7i13j$nma$1@xxxxxxxxxxxxxxxxxxxxx
Hello,
I have a C S-Function which works fine in Simulink and
S-Functionnow would
like to compile to a dSpace system using RTW. The
get thegets
itsvariable.
parameters out off the Matlab workspace via a structure
The
S-Function also uses Mex functions (a.o. mxGetField to
supported bydata out of
the structure, mxGetPr, mxGetM, mxGetN, mxSetM, mxSetN,mexCallMatlab to
use Matlab's inv function).
Apparently some of these mex functions are not
stillRTW.
How can I
adapt my S-function to make it compile with RTW? Can I
matrixuse
the
Matlab structure as a parameter? Do I have to code the
butyouinverse
function inv myself in C?
Thanks in advance,
Bert
Hi Bert,
what sort of application are you building ?
If it's RT critical - like most of those running on dSpace HW -
should actually:
1) not have your Simulink s-function directly included in it,
ininstead write a companion TLC file to produce the C-source
implementing its functionality - i.e. have a "fully inlined
s-function";
2) any mx... / mex.... API call has no place in an embedded
environment (would you really want to run Matlab on it ?), no
surprise, for once, that RTW doesn't support it;
3) I suspect the Embedded Matlab block (embedding Matlab calls
Simulink) may not be that good again in case of a RT target;(plenty of
4) you will have to replace "inv" calls with some suitable
alternative algorithm using supported algebraic operations
functions in the standard rtlib library, and you may include an
additional external library if you want/need it).
HTH
Riccardo
Hi,
I agree with the exception of 3): the Embedded MATLAB function
block is not to be mixed up with the MATLAB function block.
The Embedded MATLAB function block supports only a subset
of MATLAB (for details see doc), but translates the MATLAB
code to embeddable C-code...
Titus
Hi Titus,
My fault the mixup: never used the block - actually never seen it as
I've always been using R13 SP1 for autocoding.
Anyway, forgive me but I would still go for an inlined s-function.
Riccardo
.
- Follow-Ups:
- References:
- Re: compile C S-Function which uses MEX calls with RTW
- From: Titus
- Re: compile C S-Function which uses MEX calls with RTW
- From: riccardo
- Re: compile C S-Function which uses MEX calls with RTW
- From: Titus
- Re: compile C S-Function which uses MEX calls with RTW
- Prev by Date: Please help - nurbs toolbox
- Next by Date: Re: Matlab post
- Previous by thread: Re: compile C S-Function which uses MEX calls with RTW
- Next by thread: Re: compile C S-Function which uses MEX calls with RTW
- Index(es):
Relevant Pages
|
Loading