MATLAB SIMULINK 7 - DEVELOPING S-FUNCTIONS Betriebsanweisung Seite 53

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 210
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 52
Writing Basic C MEX S-Functions
3-9
mdlOutput:
- The numerical calculation.
mdlOutputs tells S imulink to multiply the
input signal by 2.0 and place the result in the output sig nal.
- To access the input signal, use:
InputRealPtrsType uPtrs = ssGetInputPortRealSignalPtrs(S,0);
where uPtrs is a vector of pointers and must be accessed using:
*uPtrs[i]
For more details, see Data View of S-Functions” on page 3–19.
- To a ccess the output signal, use
real_T *y = ssGetOutputPortRealSignal(S,0);
This returns a contiguous a rray for the block’s outputs.
- The S -function loops o ver the width of the signal passing through the
block. To access the width, you can check the input or output port width.
Here the output port width was evaluated.
mdlTerminate:
- This is a mandatoryS-function routine. However, the
timestwo S-function
doesn’t need to perform any termination actions, so this routine is empty.
Atthe end ofthe S-function,specifycode thatattaches this exampleto either
Simulink or the Real-Time Workshop:
#ifdef MATLAB_MEX_FILE
#include "simulink.c"
#else
#include "cg_sfun.h"
#endif
Seitenansicht 52
1 2 ... 48 49 50 51 52 53 54 55 56 57 58 ... 209 210

Kommentare zu diesen Handbüchern

Keine Kommentare