MATLAB Answers


Create a Matlab Function with the same input of a S-Function

Asked by Antonio Parziale on 15 Dec 2018
Latest activity Edited by Antonio Parziale on 15 Dec 2018
Dear all,
My simulink model contains a SFunction written in Matlab.
If I try to compile the model in Rapid Acceleration Mode the following error is provided.
I read that a soluton is to use a Matlab Function block instead of an SFunction because my code is written in Matlab.
My function needs the following parameters that are provided to an SFunction by default: t, x, u, flag
The outputs of my function are [sys, x0, str, ts] even if only sys is the output of the SFunction Block.
How can i create a Matlab function block that receives the same inputs and get out the same output? Just for example, Where is the flag input?
MFile S-functions without a
corresponding TLC file are not supported. You can inline
your S-function (name) by creating a TLC file for it.
You can also remap your S-function to C by creating a
corresponding C Mex source file and a name.tlc file in
the same directory as the MFile S-function which contains
(on the first line):


Sign in to comment.

0 Answers