Removing the extra part from the figure entered in MATLAB
2 次查看(过去 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
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!