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

formatMATLABsaveas

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')

Best Answer

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! :)