Main Content

loadImpl

Class: Simulink.io.FileType
Package: Simulink.io

Load signal names from custom FileType object

Syntax

matFileData = loadImpl(reader)

Description

matFileData = loadImpl(reader) loads the signal names listed in the custom FileType object.

Run-Time Details

loadImpl is called via load when you run the Simulink.io.FileType object. You can also run the application, which calls load. For details, see Create Custom File Type for Import to Signal Editor.

Input Arguments

expand all

Signals to load, specified as a Simulink.io.FileType object.

Data Types: char

Output Arguments

expand all

Variables of signals to load, returned as a cell array of signal variables of supported types. For more information on supported types, see Choose a Base Workspace and MAT-File Format.

Examples

expand all

Subclass FileType class and implement the loadImpl method.

classdef MySignalMatFile < Simulink.io.FileType

Implement the static method loadImpl.

methods
        
        function structOut = loadImpl(obj)
            structOut = struct;
            
            %assume mat-file
            data = load(obj.FileName);
            varsOnFile = fieldnames(data);
            
            for k = 1: length(varsOnFile)
                
                if isSimulinkSignalFormat(data.(varsOnFile{k}))
                    structOut.(varsOnFile{k}) = ...
                        data.(varsOnFile{k});
                end
            end
        end
    end
Introduced in R2020a