Main Content

registerWorkspaceReader

Class: io.reader
Namespace: io

Register custom workspace reader for the Simulation Data Inspector

Since R2020b

Syntax

registerWorkspaceReader(obj)

Description

registerWorkspaceReader(obj) registers the custom workspace reader specified by obj for the Simulation Data Inspector. To use a custom workspace reader, you must register the reader at the start of each MATLAB® session.

Tip

To verify registration, use the io.reader.getRegisteredWorkspaceReaders method.

Input Arguments

expand all

Custom data reader, specified as an object of a class that inherits from the io.reader base class.

Example: MyCustomReader

Examples

expand all

This example shows how to register a custom workspace data reader with the Simulation Data Inspector, verify registration was successful, and unregister the workspace reader.

This example registers a custom workspace data reader called SimpleStructReader. For an example that shows how to author the custom workspace reader, see Import Workspace Variables Using a Custom Data Reader.

registerWorkspaceReader(SimpleStructReader);

To verify registration of a custom workspace reader, use the io.reader.getRegisteredWorkspaceReaders method, which returns a string array that contains the names of all registered custom workspace readers.

io.reader.getRegisteredWorkspaceReaders
ans = 
"SimpleStructReader"

To unregister a custom workspace reader, use the unregisterWorkspaceReader method. All readers are unregistered when you close the MATLAB™ session.

unregisterWorkspaceReader(SimpleStructReader);

Version History

Introduced in R2020b