Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当我尝试使用“saveas”保存箱线图时,如下所示
X = randn(10, 10); H = boxplot(X); saveas(H, 'x.fig');
我收到错误
??? Error using ==> saveas at 72 Simulink object array must be a vector.
出现此错误是因为 H 是箱形图中线条的句柄矩阵,但 saveas 要求 H 是单个句柄。有人可以告诉我如何使用命令保存箱线图吗?谢谢。
SAVEAS需要一个图形句柄作为其第一个输入。BOXPLOT与大多数其他绘图函数一样,返回绘制的图形对象的句柄,但不返回图形句柄。
因此,您应该编写saveas(gcf,'x.fig'),它使用GCF来查询当前图形的句柄,即绘制箱线图的图形。
saveas(gcf,'x.fig')