How can I save the final output in a matrix without manually save it on the image panel using patch?
    4 Ansichten (letzte 30 Tage)
  
       Ältere Kommentare anzeigen
    
    Chen
 am 30 Mai 2020
  
    
    
    
    
    Beantwortet: Ameer Hamza
      
      
 am 30 Mai 2020
            I have code like this:
x=[0 10 5];
y=[0 0 8.66];
patch(x,y,'white') 
set(gca,'Color','k','xticklabel',[],'yticklabel',[])
daspect([1 1 1]);
xlim([-5 15])
ylim([-5 15])
How can I save the final output image in a matrix without manually save it on the popup image panel?
I tried to let 'p = patch(x,y,'white')' but it is not the final pop-up output window. Thanks so much! 
0 Kommentare
Akzeptierte Antwort
  Ameer Hamza
      
      
 am 30 Mai 2020
        Use getframe() to get the graphics as an image matrix
x=[0 10 5];
y=[0 0 8.66];
patch(x,y,'white') 
set(gca,'Color','k','xticklabel',[],'yticklabel',[])
daspect([1 1 1]);
xlim([-5 15])
ylim([-5 15])
frame = getframe(gca);
img = frame.cdata;
0 Kommentare
Weitere Antworten (1)
  Image Analyst
      
      
 am 30 Mai 2020
        Use exportgraphics() (introduced in r2020a).  For example:
exportgraphics(gca,'myplot.jpg','Resolution',300)
0 Kommentare
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


