| Products & Services | Industries | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Simulink |
| Contents | Index |
| Learn more about Simulink |
[time, data] = signalbuilder(block)
[time, data, signames] = signalbuilder(block)
[time, data, signames, groupnames] = signalbuilder(block)
block = signalbuilder([], 'create', time, data, signames,
groupnames)
block = signalbuilder(path, 'create', time, data, signames,
groupnames)
block = signalbuilder(path,'create', time, data, signames,
groupnames, vis)
block = signalbuilder(path,'create', time, data, signames,
groupnames, vis, pos)
block = signalbuilder(block, 'append', time, data, signames,
groupnames)
[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')
Use the signalbuilder command to interact programmatically with 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, signames] = signalbuilder(block) returns the signal names, signames, in a string or a cell array of strings.
[time, data, signames, groupnames] = signalbuilder(block) returns the group names, groupnames, in a string or a cell array of strings.
block = signalbuilder([], 'create', time, data, signames, groupnames) 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 names, signames, and group names, groupnames, can be omitted to use default values. The function returns the path to the new block, block. Always provide time and data when using the create command. These two parameters are always required.
block = signalbuilder(path, 'create', time, data, signames, groupnames) creates a new Signal Builder block at path using the specified values. If path is empty, the function creates a block in a new model, which has a default name. If data is a cell array and time is a vector, the time values are duplicated for each element of data. Each vector within 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 names, signames, and group names, groupnames, can be omitted to use default values. The function returns the path to the new block, block. Always provide time and data when using the create command. These two parameters are always required.
block = signalbuilder(path,'create', time, data, signames, groupnames, vis) creates a new Signal Builder block and sets the visible signals in each group based on the values of the matrix vis. This matrix must be the same size as the cell array, data. Always provide time and data when using the create command. These two parameters are always required.
block = signalbuilder(path,'create', time, data, signames, groupnames, vis, pos) creates a new Signal Builder block and sets the block position to pos. Always provide time and data when using the create command. These two parameters are always required.
block = signalbuilder(block, 'append', time, data, signames, groupnames) 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.
[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 name, 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.
Note The signalbuilder function does not allow you to alter and delete data in the same invocation. It also does not allow you to delete all the signals and groups from the application. |
index = signalbuilder(block, 'activegroup') gets the index of the active group.
signalbuilder(block, 'activegroup', index) sets the active group index to index.
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:
| Field | Description | Example 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], |
| 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.
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], 'Signal 2', 'Group 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, [], [])
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.

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2010- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |