Removing the extra part from the figure entered in MATLAB
조회 수: 1 (최근 30일)
이전 댓글 표시
Hello, I saved this photo with the help of MATLAB and now I want to crop this photo only in the area I want.
These photos are the result of saving the plots of a dragging code, and now I want to crop them by calling them
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1560779/image.png)
댓글 수: 0
답변 (1개)
Dyuman Joshi
2023년 12월 5일
편집: Dyuman Joshi
2023년 12월 5일
Description of the function - "exportgraphics(obj,filename) saves the contents of the graphics object specified by obj to a file. The graphics object can be any type of axes, a figure, a standalone visualization, a tiled chart layout, or a container within the figure. The resulting graphic is tightly cropped to a thin margin surrounding your content."
Note that underlined part.
댓글 수: 2
Dyuman Joshi
2023년 12월 5일
편집: Dyuman Joshi
2023년 12월 5일
Copy and pasting the first example from the documentation page linked above -
%Generate a plot
plot(rand(5,5))
%Get the current axes
ax = gca;
%Export the axes to an image
exportgraphics(ax,'LinePlot.png')
%Check the contents of the current folder
ls
참고 항목
카테고리
Help Center 및 File Exchange에서 Printing and Saving에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!