Error using saveas (line 179) Unsupported format or extension: png

22 ビュー (過去 30 日間)
Michael
Michael 2019 年 12 月 12 日
コメント済み: Guillaume 2019 年 12 月 12 日
Hi
I recently upgraded from MATLAB 2017b to 2019b. And now I can't get the saveas function to work. When using the example from the documentation, see below, I get the error that you see in the Question title. Hope you can help me!
x = [2 4 7 2 4 5 2 5 1 4];
bar(x);
saveas(gcf,'Barchart.png')
  3 件のコメント
Guillaume
Guillaume 2019 年 12 月 12 日
編集済み: Guillaume 2019 年 12 月 12 日
What does
which saveas -all
return?
Actually, since it appears that it's calling the correct saveas (line 179 is where built-in saveas would error), what is the output of:
[~, dev, ext] = printtables(printjob(gcf));
Michael
Michael 2019 年 12 月 12 日
Hi Guillaume
Thanks for you trying to help.
>> which saveas -all
C:\Program Files\MATLAB\R2019b\toolbox\matlab\general\saveas.m
And the output is
>> [~, dev, ext] = printtables(printjob(gcf))
dev =
44×1 cell array
{'win' }
{'winc' }
{'meta' }
{'bitmap' }
{'ps' }
{'psc' }
{'ps2' }
{'ps2c' }
{'psc2' }
{'eps' }
{'epsc' }
{'eps2' }
{'eps2c' }
{'epsc2' }
{'tiff' }
{'tiffnocompression'}
{'bmp' }
{'hdf' }
{'png' }
{'svg' }
{'jpeg' }
{'pcxmono' }
{'pcxgray' }
{'pcx16' }
{'pcx256' }
{'pcx24b' }
{'bmpmono' }
{'bmp16m' }
{'bmp256' }
{'pngmono' }
{'pnggray' }
{'png16m' }
{'png256' }
{'pbm' }
{'pbmraw' }
{'pgm' }
{'pgmraw' }
{'ppm' }
{'ppmraw' }
{'tiffpack' }
{'tiff24nc' }
{'pdfwrite' }
{'prn' }
{'prnc' }
ext =
44×1 cell array
{0×0 char}
{0×0 char}
{'emf' }
{'bmp' }
{'ps' }
{'ps' }
{'ps' }
{'ps' }
{'ps' }
{'eps' }
{'eps' }
{'eps' }
{'eps' }
{'eps' }
{'tif' }
{'tif' }
{'bmp' }
{'hdf' }
{'png' }
{'svg' }
{'jpg' }
{'pcx' }
{'pcx' }
{'pcx' }
{'pcx' }
{'pcx' }
{'bmp' }
{'bmp' }
{'bmp' }
{'png' }
{'png' }
{'png' }
{'png' }
{'pbm' }
{'pbm' }
{'pgm' }
{'pgm' }
{'ppm' }
{'ppm' }
{'tif' }
{'tif' }
{'pdf' }
{0×0 char}
{0×0 char}

サインインしてコメントする。

採用された回答

Michael
Michael 2019 年 12 月 12 日
Guillaume, your comments made me think of the risk of multiple functions and I found the mistake.
I had a strmatch function in my "custom MATLAB function folder" which I copied from an earlier version of MATLAB because MATLAB said that the function would be removed in a later release.
I removed my strmatch function and the problem is now gone! I would not have thought of this without your input. Thanks very much for your help! :)
  1 件のコメント
Guillaume
Guillaume 2019 年 12 月 12 日
Yes, as your printtable output, that would have been my next suggestion, that or you're shadowed isempty but that's less likely.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangePrinting and Saving についてさらに検索

タグ

製品


リリース

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by