Main Content

connectXYPlot

Connect X and Y signal structures to display on axes

Since R2024b

Description

connectXYPlot(instrument_object,hAxis,xSignal,ySignal,Name,Value) connects two signals by using the xSignal struct and ySignal struct to display as an XY plot on an axes. The axes for connectXYPlot cannot be bound to some other signal, for example bound to another XY Plot or bound as a Time Plot by using connectLine.

Specify the X and Y signals for connectXYPlot by using structures. The BlockPath and PortIndex struct fields are mandatory. The Callback, BusElement, and ArrayIndex struct fields are optional. For more information, see More About.

example

Examples

collapse all

Connect an X signal structure and Y signal structure to display as an XY plot on an axes object. This example applies optional line style, maximum points, and decimation.

mldatxfile = 'slrt_ex_pendulum_100Hz.mldatx';
hInst  = slrealtime.Instrument(mldatxfile);
xSig = struct('BlockPath', {'x'}, ...
              'PortIndex', {-1}, ...
              'Callback', @(t,d)d+2);
ySig = struct('BlockPath', {[mdl '/Bus Creator']}, ...
              'PortIndex', {1}, ...
              'ArrayIndex', {3}, ...
              'BusElement', {'signal2'}); 
connectXYPlot(hInst,myAxis,xSig,ySig, ...
              'LineStyle',ls, ...
              'MaxPoints',100, ...
              'Decimation', 5);

Input Arguments

collapse all

To create the instrument object, use the Instrument function.

Example: hInst

To create an axes object, use hAxis = gca or hAxis = axes ().

Example: myAxes

For the selected block, gcb returns the full block path name.

Example: slrt_ex_pendulum_100Hz/Pendulum

For the selected block, gcb returns the full block path name.

Example: slrt_ex_pendulum_100Hz/Pendulum

The Name,Value pair argument selects the signal properties that are added to the instrument object instrument_object and sets values for the properties.

Example: 'Decimation',2

Name-Value Arguments

collapse all

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Example: 'Decimation',2

Specifies a decimation value for the signal. Permitted values for decimation are from 1 to 256.

Example: 'Decimation',2

Select an slrealtime.instrument.LineStyle object that customizes the line appearance. For more information about object, see slrealtime.instrument.LineStyle.

Example: 'LineStyle', objectName

Maximum number of data points to plot, specified as an integer scalar. The default value of is empty, which means the chart plots all of the available data points provided by the xSignal and ySignal structures.

Example: 'MaxPoints',100

More About

collapse all

Version History

Introduced in R2024b