Main Content

Simulink.io.SignalBuilderSpreadsheet Class

Namespace: Simulink.io

Read spreadsheet in format used by Signal Builder

Since R2020a

Description

Simulink.io.SignalBuilderSpreadsheet inherits from the Simulink.io.FileType base class. It reads spreadsheets formatted in a format used by Signal Builder. This class does not support CSV files with headers.

To import spreadsheets used in Signal Builder, use this class.

classdef SignalBuilderSpreadsheet < Simulink.io.FileType

The Simulink.io.SignalBuilderSpreadsheet class is a handle class.

Class Attributes

Abstract
false
HandleCompatible
true

For information on class attributes, see Class Attributes.

Properties

expand all

File name of file that contains signals to import to Signal Editor, specified as a character array.

Attributes:

GetAccess
public
SetAccess
public

Data Types:

Methods

expand all

Examples

collapse all

Interact with FileType using specialized functions. This example refers to the open('Simulink.io.CreateSignals') sample file.

Get contents of Signal Builder format foo.xlsx spreadsheet.

fileName = 'foo.xlsx';
aReader = Simulink.io.SignalBuilderSpreadsheet(fileName);
resultOfWhos = whos( aReader );

Load the custom signals in foo.xlsx.

fileName = 'foo.xlsx';

aReader = Simulink.io.SignalBuilderSpreadsheet(fileName);
varsOnFileStruct = load(aReader,'myGroup1');

Load a variable from foo.xlsx.

fileName = 'foo.xlsx';

aReader = Simulink.io.SignalBuilderSpreadsheet(fileName);
var = loadAVariable(aReader,'myGroup1');

Import custom signals from foo.xlsx.

fileName = 'foo.xlsx';

aReader = Simulink.io.SignalBuilderSpreadsheet(fileName);
importedVars = import(aReader,'myGroup1');

Export the signals from Signal Editor.

ds = Simulink.SimulationData.Dataset;
ds = ds.addElement(timeseries([1:10]',[1:10]'),'Signal1'); %#ok<*NBRAK>
ds = ds.addElement(timeseries([1:10]',[11:20]'),'Signal2');
ds = ds.addElement(timeseries([1:10]',[21:30]'),'Signal3');

aReader = Simulink.io.SignalBuilderSpreadsheet('myFileToExport.xls');

didWrite = aReader.export(filePath,{'ds'},{ds},0);

Version History

Introduced in R2020a