Main Content

getPersistentDataInterfaces

Class: coder.descriptor.MeasurementServiceInterface
Namespace: coder.descriptor

Return information about datastore and state measurement service interfaces with persistent data specification

Since R2025a

Syntax

persistentDataInterfaces = getPersistentDataInterfaces(measurementInterfaceObj)

Description

persistentDataInterfaces = getPersistentDataInterfaces(measurementInterfaceObj) returns an array of coder.descriptor.DataInterface objects representing all of the persistent data in the measurement service interface.

Input Arguments

expand all

Measurement service interface object, specified as a coder.descriptor.MeasurementServiceInterface object. You can create this object by using the getServiceInterface method.

Output Arguments

expand all

Persistent data measurement service interface, returned as a coder.descriptor.DataInterface object or an array of coder.descriptor.DataInterface objects. The coder.descriptor.DataInterface object contains information about the specified data interface, such as the type of data, Simulink® identifier, graphical name, timing, implementation, and variant information.

Examples

expand all

Open the example and example model.

openExample('ecoder/GenerateMeasureServiceInterfaceCodeForPersistentDataExample')
open_system('ComponentServiceWithPersistency');

The attached Embedded Coder® Dictionary ComponentServiceCoderDictionary.sldd defines a measurement service interface with persistent data support enabled.

The Integrator subsystem contains a Discrete-Time Integrator block whose input is a signal of length 10. Configure the block so it has a different initial condition for each signal element.

set_param('ComponentServiceWithPersistency/Integrator/Discrete-Time Integrator', ...
            InitialCondition='1:10')

Build the model.

slbuild('ComponentServiceWithPersistency')

Create a coder.codedescriptor.CodeDescriptor object for the required model.

codeDescObj = coder.getCodeDescriptor('ComponentServiceWithPersistency')

Create a coder.codedescriptor.ServiceInterface object from the code descriptor object.

serviceObj = getServices(codeDescObj);

Create a coder.descriptor.MeasurementServiceInterface object from the service interface object.

measurementServiceInterface = getServiceInterface(serviceObj,'Measurement');

Retrieve persistent data interfaces from the measurement service interface object.

persistentDataInterfaces = getPersistentDataInterfaces(measurementServiceInterface);
persistentDataInterfaces = 
  1×2 ReadWriteDataInterface array with properties:

    DataReads
    DataWrites
    Type
    SID
    GraphicalName
    VariantInfo
    Implementation
    Timing
    Unit
    Range

The method returns persistent data interface objects for the Unit Delay and Discrete-Time Integrator blocks. These blocks contain persistent data, such as initial conditions, that are stored in nonvolatile memory for subsequent time steps.

Get the initial condition of the Discrete-Time Integrator block.

get_param(persistentDataInterfaces(2).SID,'InitialCondition')
ans =
    '1:10'

Version History

Introduced in R2025a