1

I have a really frustrating problem with Matlab. I want to convert a Matlab plot into an eps file. It has always worked fine, last time about half an hour ago, but now it seems to not work anymore. Whenever I type in the command:

print -depsc filename.eps

Matlab says:

Error using validateHandleToPrint (line 26)
No Figure to print.

Error in validate (line 17)
pj = validateHandleToPrint(pj);

Error in print (line 201)
    pj = validate( pj );
4

1 回答 1

0

如果您在print()没有显式传递图形句柄的情况下调用该函数,它将尝试打印gcf()当前图形句柄。

如果由于某种原因,当前图形句柄不再有效(例如,您关闭了图形),那么它将抛出您得到的错误。

您可以通过检查有条件地打印ishghandle()

if ishghandle(gcf)
    print ...
end
于 2013-04-15T15:59:43.330 回答