- that line object still exists in the figure: In that case, you can toggle its visibility, change its properties (colour, line style, etc.) or do all sorts of things with it, but in any case, it is still part of whichever figure you created it in.
- that line object no longer exists, for example the figure has been closed or the plot was deleted because you plotted on the same figure without hold on. In that case, the handle that you've stored in your variable is no longer valid. It does not contain any information about the original plot. It's completely useless and there is no way to retrieve the original plot.
Replot a matlab.graphics.chart
조회 수: 12(최근 30일)
Guillaume 2017년 9월 6일
JB, looking at the various comments in this question, I've got the feeling that you're not totally understand what it is that the plot function returns.
The plot function returns a handle to a line object (which you store in your plotdata variable in one of your comment). Now one of two things can happen:
This is why your question is confusing. Either the plot still exists (it may be hidden), in which case there's nothing to do to replot (except maybe unhide the plot), or the plot no longer exists in which case what you've stored is now useless and you'll have to call the plot function to replot
KL 2017년 9월 6일
편집: KL 2017년 9월 6일
plot1 is the axis handle. "re-plotting" means plotting on the same figure window with the new data.
for iCount = 1:5
x = iCount*[2 4 6 8];
y = iCount*[10 20 30 40];
h1 = figure(1); %h1 is figure handle
plot1=plot(x,y); %plot1 is axis handle
If you want to retain the plot from previous loop, use hold on at the end of for loop