signalbuilder - Create and access Signal Builder blocks

Syntax

[time, data] = signalbuilder(block)
[time, data, siglabels] = signalbuilder(block)
[time, data, siglabels, grouplabels] = signalbuilder(block)
block = signalbuilder([], 'create', time, data, siglabels, 
        grouplabels)
block = signalbuilder(block, 'append', time, data, siglabels, 
        grouplabels)

[time, data] = signalbuilder(block, 'get', signal, group)
signalbuilder(block, 'set', signal, group, time, data)

index = signalbuilder(block, 'activegroup')
signalbuilder(block, 'activegroup', index)

signalbuilder(block, 'print', [])
signalbuilder(block, 'print', config, printArgs)
figh = signalbuilder(block, 'print', config, 'figure')

Description

Use the signalbuilder command to interact programmatically with Signal Builder blocks.

Create and Access Signal Builder Blocks

[time, data] = signalbuilder(block) returns the time (x-coordinate) and amplitude (y-coordinate) data of the Signal Builder block, block.

The output arguments, time and data, take different formats depending on the block configuration:

Configuration

Time/Data Format

1 signal, 1 group

Row vector of break points.

>1 signal, 1 group

Column cell vector where each element corresponds to a separate signal and contains a row vector of breakpoints.

1 signal, >1 group

Row cell vector where each element corresponds to a separate group and contains a row vector of breakpoints.

>1 signal, >1 group

Cell matrix where each element (i, j) corresponds to signal i and group j.

[time, data, siglabels] = signalbuilder(block) returns the signal labels, siglabels, in a string or a cell array of strings.

[time, data, siglabels, grouplabels] = signalbuilder(block) returns the group labels, grouplabels, in a string or a cell array of strings.

block = signalbuilder([], 'create', time, data, siglabels, grouplabels) creates a Signal Builder block in a new Simulink model using the specified values. The preceding table describes the allowable formats of time and data. If data is a cell array and time is a vector, the time values are duplicated for each element of data. Each vector in time and data must be the same length and have at least two elements. If time is a cell array, all elements in a column must have the same initial and final value. Signal labels, siglabels, and group labels, grouplabels, can be omitted to use default values. The function returns the path to the new block, block.

block = signalbuilder(block, 'append', time, data, siglabels, grouplabels) appends new groups to the Signal Builder block, block. The time and data arguments must have the same number of signals as the existing block.

Get/Set Methods for Specific Signals and Groups

[time, data] = signalbuilder(block, 'get', signal, group) gets the time and data values for the specified signal(s) and group(s). The signal argument can be the name of a signal, a scalar index of a signal, or an array of signal indices. The group argument can be a group label, a scalar index, or an array of indices.

signalbuilder(block, 'set', signal, group, time, data) sets the time and data values for the specified signal(s) and group(s). Use empty values of time and data to remove groups and signals.

Query and Set the Active Group

index = signalbuilder(block, 'activegroup') gets the index of the active group.

signalbuilder(block, 'activegroup', index) sets the active group index to index.

Print Signal Groups

signalbuilder(block, 'print', []) prints the currently active signal group.

signalbuilder(block, 'print', config, printArgs) prints the currently active signal group or the signal group that config specifies. The argument config is a structure that allows you to customize the printed appearance of a signal group. The config structure may contain any of the following fields:

FieldDescriptionExample Value
groupIndex

Scalar specifying index of signal group to print

2
timeRange

Two-element vector specifying the time range to print (must not exceed the block's time range)

[3 6]
visibleSignals

Vector specifying index of signals to print

[1 2]
yLimits

Cell array specifying limits for each signal's y-axis

{[-1 1],
 [0 1]}

extent

Two-element vector of the form:

[width, height]

specifying the dimensions (in pixels) of the area in which to print the signals

[500 300]
showTitle

Logical value specifying whether to print a title; true (1) prints the title

false

The optional argument printArgs allows you to configure print options (see print in the MATLAB Function Reference).

figh = signalbuilder(block, 'print', config, 'figure') prints the currently active signal group or the signal group that config specifies to a new hidden figure handle, figh.

Examples

Example 1

The following command creates a new Signal Builder block in a new model editor window:

block = signalbuilder([], 'create', [0 5], {[2 2];[0 2]});

The Signal Builder block contains two signals in one group. To alter the second signal in the group, use the set keyword as follows:

signalbuilder(block, 'set', 2, 1, [0 5], [2 0])

To delete the first signal from the group, enter the following command:

signalbuilder(block, 'set', 1, 1, [], [])

To add a new signal in a new group, use the append keyword as follows:

signalbuilder(block, 'append', [0 2.5 5], [0 2 0]);

Example 2

The following command creates a new Signal Builder block in a new model editor window:

block = signalbuilder([], 'create', [0 2], {[0 1],[1 0]});

The Signal Builder block has two groups, each of which contains a signal. To delete the second group, simply delete its signal with the following command:

signalbuilder(block, 'set', 1, 2, [], [])

Example 3

The following command creates a new Signal Builder block in a new model editor window:

block = signalbuilder([], 'create', [0 1], ...
         {[0 0],[1 1];[1 0],[0 1];[1 1],[0 0]});

The Signal Builder block has two groups, each of which contains three signals.

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS