I need to create a movie. Suppose, I create an axis and plot on it something very customized:
figure;
ax = plot(x, y, 'linewidth', 3, 'prop1', value1, 'prop2', value2, ...);
grid minor;
axis(ax, [xmin xmax ymin ymax]);
legend(ax, ...);
xlabel(ax, ...);
ylabel(ax, ...);
title(ax, ...);
Now I run a loop, where only the values of y are being updated.
for k = 1 : N
% y changes, update the axis
end
What is the fastest and easiest way to update the axis with new y (or x and y), keeping all the axis properties?
A fast way is to simply update the y-values of the data you’ve plotted:
EDIT What if there are multiple lines, i.e.
lineHandleis a vector? You can still update in one step; you need to convert the data to a cell array, though.