Download Target Language Compiler Reference Guide

Transcript
Inlining Fortran (FMEX) S-Functions
Inlining Fortran (FMEX) S-Functions
The capabilities of Fortran MEX S-functions can be fully inlined using a TLC
block target file. With a simple F MEX S-function version of the ubiquitous
“timestwo” function, this interface can be illustrated. Here is the sample
Fortran S-function code
C
C
FTIMESTWO.FOR
C
$Revision: 1.1$
C
C
A sample FORTRAN representation of a
C
timestwo S-function.
C
Copyright 1990-2000 The MathWorks, Inc.
C
C=====================================================
C
Function: SIZES
C
C
Abstract:
C
Set the size vector.
C
C
SIZES returns a vector which determines model
C
characteristics. This vector contains the
C
sizes of the state vector and other
C
parameters. More precisely,
C
SIZE(1) number of continuous states
C
SIZE(2) number of discrete states
C
SIZE(3) number of outputs
C
SIZE(4) number of inputs
C
SIZE(5) number of discontinuous roots in
C
the system
C
SIZE(6) set to 1 if the system has direct
C
feedthrough of its inputs,
C
otherwise 0
C
C=====================================================
C
SUBROUTINE SIZES(SIZE)
C
.. Array arguments ..
INTEGER*4
SIZE(*)
7-19