Delete rectangles drawn in figure axes
    10 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    Valentin Stegmaier
 el 3 de Jul. de 2019
  
    
    
    
    
    Respondida: Harsha Priya Daggubati
    
 el 17 de Jul. de 2019
            Hi there,
i try to delete all rectangles drawn into a figure axes. When creating these Rectangles, they're saved to a struct which is present in the function where i want to delete the existing rectangles. How can i detect all objects of the type Rectangle, or is there a different way to gett all drawn rectangles in an figure axes?
I added a screenshot of the figure axes with one rectangle drawn in there in red:
 ?
?Im using Win 10 with Matlab R2019a.
Thanks a lot in advance.
Best
Valentin
0 comentarios
Respuestas (1)
  Harsha Priya Daggubati
    
 el 17 de Jul. de 2019
        Hi, 
You can get all the Graphics Objects of the preferred type present in MATLAB figure using ‘findall’ function in MATLAB and then delete all the objects using ‘delete’ function in MATLAB. 
For instance, try executing this code: 
figure; 
axis([0 10 0 10]); 
rectangle(‘Position’,[1 2 5 6]); 
rect = findall(gcf,’Type', 'Rectangle’); 
delete(rect); 
Refer to this documentation links: 
0 comentarios
Ver también
Categorías
				Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

