User`s guide
Introduction
1-3
Figure 1-1: The Relationship Between an S-Function Block, Its Dialog Box,
and the Source File That Defines the Block’s Behavior
In this example, the model contains two instances of an S-Function block. Both
blocks reference the same source file (
mysfun, which can be either a C MEX-file
or an M-file). If both a C MEX-file and an M-file exist with the same name, the
C MEX-file takes precedence and is the file that the S-function uses.
You can use Simulink’s masking facility to create custom dialog boxes and
icons for your S-Function blocks. Masked dialog boxes can make it easier to
specify additional parameters for S-functions. For discussions of additional
parameters and masking, see Using Simulink.
A model that includes
two S-Function blocks
S-Function dialog box
S-Function1 dialog box
S-function
source file
/*
* MYSFUN
*
*/
/* The follo
#define S_FU
.
.
.
function[sys
% mysfun M-file
%
switch(flag)
.
.
.
C MEX-file
M-file
or