Main Content

io.reader.getRegisteredFileReaders

Class: io.reader
Package: io

Return all custom file readers registered for the Simulation Data Inspector

Syntax

readers = io.reader.getRegisteredFileReaders

Description

readers = io.reader.getRegisteredFileReaders returns an array of strings that indicate all custom file readers registered for the Simulation Data Inspector.

Output Arguments

expand all

Custom file readers registered for the Simulation Data Inspector, returned as an array of strings.

Attributes

Statictrue

To learn about attributes of methods, see Method Attributes.

Examples

expand all

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

Register the Custom File Reader

This example registers the file reader ExcelFirstColumnTime. For an example that shows how to author the custom file reader, see Import Data Using a Custom File Reader. As the name suggests, the custom file reader for this example supports Microsoft Excel™ files. Register the reader for the .xlsx and .xls extensions.

registerFileReader(ExcelFirstColumnTimeReader, [".xlsx" ".xls"]);

Verify Custom Reader Registration

To verify registration of a custom reader, you can use the io.reader.getRegisteredFileReaders method or the io.reader.getSupportedReadersForFile method.

The io.reader.getRegisteredFileReaders returns a string array that contains the names of all registered custom file readers.

io.reader.getRegisteredFileReaders
ans = 1×2 string
    "ExcelFirstColumnTimeReader"    "ExcelFirstColumnTimeReader"

You can also use the io.reader.getSupportedReadersForFile method to see all reader options for a specific file. The built-in option in the returned string array indicates that the Simulation Data Inspector has a built-in Excel file reader.

 io.reader.getSupportedReadersForFile('CustomFile.xlsx')
ans = 1×2 string
    "ExcelFirstColumnTimeReader"    "built-in"

Unregister a Custom File Reader

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

unregisterFileReader(ExcelFirstColumnTimeReader, [".xlsx" ".xls"])
Introduced in R2020b