How long does Hold on; last?
    5 Ansichten (letzte 30 Tage)
  
       Ältere Kommentare anzeigen
    
    Real Name
      
 am 5 Feb. 2017
  
    
    
    
    
    Beantwortet: Image Analyst
      
      
 am 6 Feb. 2017
            I'm trying to plot a couple of graphs, but each refresh and rerun I do, the graph doesn't seem to be updating. Sometimes it does update but the old plots remain and the new plots get attached to it. Is it because of hold on;? Does it last beyond the script?
This is my code:
LabResponse = csvread('scope_0.csv', 2, 0);
LabResponse(:,1) = LabResponse(:,1) + 0.0015;
t = linspace(0, 1, 10000);
y = 1-exp(- t ./ (1000 * 10^(-6)));
plot(t,y); hold on;
plot(LabResponse(:,1), LabResponse(:,3));
xlabel('t');
ylabel('y');
axis([0 0.01 0 1])
0 Kommentare
Akzeptierte Antwort
  Image Analyst
      
      
 am 6 Feb. 2017
        Same answer as what Walter says, with the additional examples of when you call "hold off" or "cla".
"hold" is off by default. If you put hold on then "the old plots remain and the new plots get attached to it" is what you'll get. If you don't want that, then call "hold off" or "cla".
An even more drastic way to initialize the axes control is:
cla reset;
Nothing (no old plots or axes settings) should remain after you call that.
0 Kommentare
Weitere Antworten (1)
  Walter Roberson
      
      
 am 5 Feb. 2017
        "hold on" lasts until the axes is cleared, possibly by it being destroyed (such as if the figure is destroyed or a subplot overwrites the axes)
0 Kommentare
Siehe auch
Kategorien
				Mehr zu Creating, Deleting, and Querying Graphics Objects finden Sie in Help Center und File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!