Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

State and Work Vector

Model zero crossings and control memory allocation for S-Function blocks using work vectors

S-Function Callback Methods

mdlInitializeSizes Specify the number of inputs, outputs, states, parameters, and other characteristics of the C MEX S-function
mdlSetWorkWidths Specify the sizes of the work vectors and create the run-time parameters required by this C MEX S-function
mdlOutputs Compute the signals that this block emits
mdlZeroCrossings Update zero-crossing vector
mdlStart Initialize the state vectors of this C MEX S-function
mdlInitializeConditions Initialize the state vectors of this C MEX S-function
mdlUpdate Update a block's states

SimStruct Functions

ssSetNumDWork Specify the number of data type work vectors used by a block
ssSetDWorkComplexSignal Specify whether the elements of a data type work vector are real or complex
ssSetDWorkDataType Specify the data type of a data type work vector
ssSetDWorkName Specify the name of a data type work vector
ssSetDWorkUsageType Specify how DWork vector is used in S-function
ssSetDWorkUsedAsDState Specify that a data type work vector is used as a discrete state vector
ssSetDWorkWidth Specify the width of a data type work vector
ssGetNumDWork Get the number of data type work vectors used by a block
ssGetDWork Get a DWork vector
ssGetDWorkComplexSignal Determine whether the elements of a data type work vector are real or complex numbers
ssGetDWorkDataType Get the data type of a data type work vector
ssGetDWorkName Get the name of a data type work vector
ssGetDWorkUsageType Determine how DWork vector is used in S-function
ssGetDWorkUsedAsDState Determine whether a data type work vector is used as a discrete state vector
ssGetDWorkWidth Get the size of a data type work vector
ssGetdX Get the derivatives of a block's continuous states
ssSetNumContStates Specify the number of continuous states that a block has
ssSetNumDiscStates Specify the number of discrete states that a block has
ssSetNumNonsampledZCs Specify the number of states for which a block detects zero crossings that occur between sample points
ssGetContStates Get a block's continuous states
ssGetDiscStates Get a block's discrete states
ssGetRealDiscStates Get a block's discrete state vector
ssGetNonsampledZCs Get the zero-crossing signal values
ssGetNumContStates Get the number of continuous states that a block has
ssGetNumDiscStates Get the number of discrete states that a block has
ssGetNumNonsampledZCs Get the size of the zero-crossing vector
ssSetNumRWork Specify the size of a block's floating-point work vector
ssGetNumRWork Get the size of a block's floating-point work vector
ssGetRWork Get a block's floating-point work vector
ssGetRWorkValue Get an element of a block's floating-point work vector
ssSetRWorkValue Set an element of a block's floating-point work vector
ssSetNumIWork Specify the size of a block's integer work vector
ssGetNumIWork Get the size of a block's integer work vector
ssGetIWork Get a block's integer work vector
ssGetIWorkValue Get an element of a block's integer work vector
ssSetIWorkValue Set an element of a block's integer work vector
ssSetNumPWork Specify the size of a block's pointer work vector
ssGetNumPWork Get the size of a block's pointer work vector
ssGetPWork Get a block's pointer work vector
ssGetPWorkValue Get a pointer from a block's pointer work vector
ssSetPWorkValue Set an element of a block's pointer work vector
ssSetNumModes Specify the size of the block's mode vector
ssGetNumModes Get the size of the mode vector
ssGetModeVector Get the mode vector
ssGetModeVectorValue Get an element of a block's mode vector
ssSetModeVectorValue Set an element of a block's mode vector

Examples and How To

Zero Crossings

How to model zero crossings in a C MEX S-function.

Types of DWork Vectors

Describes and compares the functionality of different types of DWork vectors.

How to Use DWork Vectors

How to implement DWork vectors in MATLAB and C MEX S-functions.

DWork Vector Examples

Examples that illustrate the uses of different types of DWork vector.

Elementary Work Vectors

Describes integer, floating-point, pointer, and mode work vectors.

Concepts

DWork Vector Basics

An introduction to the key concepts of DWork vectors.

S-Function Callback Methods

Description of S-function callback methods

S-Function SimStruct Functions

Overview of SimStruct macros and functions.

Was this topic helpful?