Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

addpoints

Add points to animated line

Syntax

addpoints(an,x,y)
addpoints(an,x,y,z)

Description

example

addpoints(an,x,y) adds points defined by x and y to the animated line specified by an. Create an animated line with the animatedline function. To display the updates on the screen, use drawnow or drawnow limitrate. New points automatically connect to previous points.

addpoints(an,x,y,z) adds points defined by x, y, and z to the 3-D animated line specified by an.

Examples

collapse all

Create an animated line object with no data. Then, add five points to the line. Use a circle to mark each point.

h = animatedline('Marker','o');
x = 1:5;
y = 1:5;
addpoints(h,x,y)

Create an animated line using the animatedline function. Then, add points to the line within a loop to create an animation. Set the axis limits before the loop to prevent the limits from changing.

figure
h = animatedline;
axis([0 4*pi -1 1])

for x = linspace(0,4*pi,10000)
    y = sin(x);
    addpoints(h,x,y)
    drawnow limitrate
end

Input Arguments

collapse all

AnimatedLine object. Create an AnimatedLine object using the animatedline function.

x values, specified as a scalar or a vector. The length of x must equal the length of y.

Example: 11:20

Data Types: double

y values, specified as a scalar or a vector. The length of y must equal the length of x.

Example: 11:20

Data Types: double

z values, specified as a scalar or a vector. The length of z must equal the length of x and y.

Example: 11:20

Data Types: double

Introduced in R2014b

Was this topic helpful?