refreshdata - Refresh data in graph when data source is specified

Syntax

refreshdata
refreshdata(figure_handle)
refreshdata(object_handles)
refreshdata(object_handles,'workspace')

Description

refreshdata evaluates any data source properties (XDataSource, YDataSource, or 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.

Note that the variable assigned to the data source property must be in the base workspace.

refreshdata(figure_handle) refreshes the data of the objects in the specified figure.

refreshdata(object_handles) refreshes the data of the objects specified in object_handles or the children of those objects. Therefore, object_handles can contain figure, axes, or plot object handles.

refreshdata(object_handles,'workspace') enables you to specify whether the data source properties are evaluated in the base workspace or the workspace of the function in which refreshdata was called. workspace is a string that can be

Remarks

The Linked Plots feature (see documentation for linked) 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 refreshdata, as it is essentially automatically triggered every time a data source changes.

If you are not using the Linked Plots feature, you need to set the XDataSource, YDataSource, and/or ZDataSource properties of a graph in order to use refreshdata. You can do that programmatically, as shown in the examples below, or use the Property Editor, one of the plotting tools. In the Property Editor, select the graph (e.g., a lineseries 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 refreshdata causes the graph to update.

Examples

Plot a sine wave, identify data sources, and then modify its YDataSource:

x = 0:.1:8;
y = sin(x);
h = plot(x,y)
set(h,'YDataSource','y')
set(h,'XDataSource','x')
y = sin(x.^3);
refreshdata

Create a surface plot, identify a ZDataSource for it, and change the data to a different size.

Z = peaks(5);
h = surf(Z)
set(h,'ZDataSource','Z')
pause(3)
Z = peaks(25);
refreshdata

See Also

The [X,Y,Z]DataSource properties of plot objects.

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS