MATLAB Answers


Save n*Number of Pie Charts Generated from a loop

Waqar Ali Memon さんによって質問されました 2019 年 7 月 18 日
最新アクティビティ Adam Danz
さんによって コメントされました 2019 年 7 月 18 日
Hello Everyone,
I am using following code to generate pie charts:
myDir = uigetdir;
for d = 1:length(Dataset)
baseFileName = (strcat('Figure', num2str(d),'.jpg'));
fullFileName = fullfile(myDir, baseFileName);
imwrite(p, fullFileName);
I am incurring following error:
Error using imwrite (line 420)
Expected DATA to be one of these types:
numeric, logical
Instead its type was
Error in graphs (line 37)
imwrite(p, fullFileName);
Note: Except imwrite code, pie charts are generated.
Any help would be appreciated :-)
Waqar Ali Memon

  0 件のコメント

サインイン to comment.




1 件の回答

Adam Danz
回答者: Adam Danz
2019 年 7 月 18 日

Explanation of the problem
The primary resource to go to with problems like these is the documentation which describes what the first input should be to imwrite().
That link shows that the first input should be a matrix of image data. It appears you're inputting the handle to a pie chart.
From your title I understand that you want to merely save the pie charts. Use saveas().

  2 件のコメント

Waqar Ali Memon 2019 年 7 月 18 日
Thank you Adam Danz, saveas(). works :-).
Adam Danz
2019 年 7 月 18 日
Glad I could help!

サインイン to comment.

Translated by