Refresh data in graph when data source is specified
any data source properties (
ZDataSource) on all objects in graphs in the
current figure. If the specified data source has changed, the MATLAB® software
updates the graph to reflect this change.
The variable assigned to the data source property must be in
the base workspace or you must specify the
refreshes the data of the objects in the specified figure.
refreshes the data of the objects specified in
the children of those objects. Therefore,
contain figure, axes, or plot object handles.
enables you to specify whether the data source properties are evaluated
in the base workspace or the workspace of the function in which
workspace is a string that can
base — Evaluate the data
source properties in the base workspace.
caller — Evaluate the data
source properties in the workspace of the function that called refreshdata.
Plot a sine wave and return the chart line handle,
x = linspace(0,8); y = sin(x); figure h = plot(x,y);
Identify the data sources for the plot by setting the
YDataSource properties of the line to
y, respectively. Then, modify
refreshdata so that the graph updates with the changes to
h.XDataSource = 'x'; h.YDataSource = 'y'; y = sin(x.^3); refreshdata
The Linked Plots feature (see documentation for
linkdata) sets up data sources for graphs
and synchronizes them with the workspace variables they display. When
you use this feature, you do not also need to call
as it is essentially automatically triggered every time a data source
If you are not using the Linked Plots feature, you need to set
ZDataSource properties of a graph in order
refreshdata. You can do that programmatically
or use the Property Editor, one of the plotting tools. In the Property
Editor, select the graph (e.g., a chart line object) and type in (or
select from the drop-down choices) the name(s) of the workspace variable(s)
from which you want the plot to refresh, in the fields labelled X
Data Source, Y Data Source, and/or Z
Data Source. The call to
the graph to update.