MATLAB仅打印我的图形的一部分

编程入门 行业动态 更新时间:2024-10-26 06:33:25
本文介绍了MATLAB仅打印我的图形的一部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在尝试在 MATLAB 中打印图形,但是它一直在搞砸,我不知道为什么.

I'm trying to print my figure in MATLAB, but it keeps screwing up and I have no idea why.

opslaan = figure(1); plot(1:handles.aantal,handles.nauw,'-r','LineWidth',1.5); xlabel(gca,sprintf('Framenummer (%g ms per frame)',60/handles.aantal)); ylabel(gca,'dB'); set(gca,'YGrid','on'); yAsMax = ceil( ceil(max(handles.nauw)) / 2) * 2; axis([0 handles.aantal 0 yAsMax]); pause(1); print -dpng image.png

第一行只是在我的图形上绘制数据,然后标记x和y,打开网格并像我想要的那样计算y轴.这一切都很好,MATLAB在图形窗口中显示了它,就像我想要的那样.保存为.png/.jpeg/.eps时,它出错了,只打印左下角(473x355像素),其余的就消失了.

The first line is just plotting the data on my figure, then labeling x and y, turning on grid and calculating the y-axis like I want it. This all works great and MATLAB shows it like I want it in the figure window. When saving to .png / .jpeg / .eps, it goes wrong and only prints the bottom left corner (473x355 pixels), the rest just disappeared.

通过文件-> 另存为手动导出时,它可以正常工作.

When exporting manually via File -> Save As, it works correctly.

我该如何解决?

推荐答案

尝试使用以下行代替现有的打印行.

Try using the following line instead of the print line you already have.

print(opslaan,'-dpng','image.png')

print(opslaan, '-dpng', 'image.png')

另一种选择是查看imwrite.

更多推荐

MATLAB仅打印我的图形的一部分

本文发布于:2023-07-18 12:56:38,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1145014.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:图形   MATLAB

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!