Main Content

printToFigure

Print scope window to MATLAB figure

Since R2023b

Description

printToFigure(scope) prints the display window of the scope object to a new MATLAB® figure. The figure is visible by default.

fig = printToFigure(scope) prints the display window of the scope object to a new MATLAB figure and returns the handle to the figure.

example

fig = printToFigure(scope,Visible=flag) shows or hides the MATLAB figure.

Examples

collapse all

Use the printToFigure function to print the timescope object display window to a new MATLAB® figure.

View a sine wave on the Time Scope.

f = 100;
fs = 1000;
swv = sin(2.*pi.*f.*(0:1/fs:1-1/fs)).';
scope = timescope(SampleRate=fs,...
    TimeSpanSource="property", ...
    TimeSpan=1);
scope(swv);

Print the display of the sine wave to a new MATLAB figure. The function returns a handle to the figure.

scopeFig = printToFigure(scope);

The handle to the figure scopeFig lets you modify the appearance and the behavior of the figure window.

Specify a figure name and change the size of the figure to 400-by-250 pixels.

scopeFig.Name="Sine Wave Signal";
scopeFig.NumberTitle="off";
scopeFig.Position=[1 1 400 250];

When printing to figure, you can make the figure invisible by setting the Visible argument to false.

scopeFig = printToFigure(scope,Visible=false);

Input Arguments

collapse all

Scope object whose display the function prints to a MATLAB figure, specified as timescope object.

Flag to show the MATLAB figure, specified as true or false.

Data Types: logical

Output Arguments

collapse all

Handle to the MATLAB figure, returned as a Figure object. For more information on the properties of this object, see Figure Properties.

Version History

Introduced in R2023b

See Also

Objects