Save n*Number of Pie Charts Generated from a loop

조회 수: 1 (최근 30일)
Waqar Ali Memon
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);
end
I am incurring following error:
Error using imwrite (line 420)
Expected DATA to be one of these types:
numeric, logical
Instead its type was matlab.graphics.primitive.Data.
Error in graphs (line 37)
imwrite(p, fullFileName);
Note: Except imwrite code, pie charts are generated.
Any help would be appreciated :-)
Regard,s
Waqar Ali Memon

채택된 답변

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.
Solution
From your title I understand that you want to merely save the pie charts. Use saveas().
  댓글 수: 2
Waqar Ali Memon
Waqar Ali Memon 2019년 7월 18일
Thank you Adam Danz, saveas(). works :-).
Adam Danz
Adam Danz 2019년 7월 18일
Glad I could help!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Pie Charts에 대해 자세히 알아보기

제품


릴리스

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by