I know how to update the data in Matlab plot and plot it in real time; however, I d could not figure out how can I keep my background while I am updating it. Can anyone help me on that?
----------------------------------------
x=[0 2000];
y=[0 180e3];
xlim(x)
ylim(y)
I=imread('MAP.png');
%Flip the image
imagesc(x, y, flipud(I));
%Fix the axes
set(gca,'ydir','normal');
% hold on;
for i=1:2000
PlotUpdate(t(i),p(i))
grid on
pause(0.01);
end
----------------------------------------
%-------- Function is:
function PlotUpdate(speed,power)
h = plot(speed,power,'or','MarkerSize',5,'MarkerFaceColor','r');
h.XData = speed;
h.YData = power;
refreshdata(h,'caller')
end
- When I am activating "hold on" command, it will show the background + all the 2000 points plot by function (PlotUpdate).
- When I deactivate the hold on, my background picture is gone and I can only see the 2000 points in the plot!
Any idea how can I have both?
Thanks in advance,