How to create pie chart using input from text file?
조회 수: 14 (최근 30일)
이전 댓글 표시
I want to create pie chart that represent colour and percentages. Right now, I already read text file using text scan which convert data into cell array. As from my understand to create pie chart, X should be in vector or matrix and I already convert from cell to matrix using cell2mat and it does not work. I am trying to use categorical array and as a result size of pie chart is equally divided. How to make size of each slices follow to percentages value? here is my code,
load_data = fopen('out.txt');
C = textscan(load_data, '%q %q %q %s %s %q');
fclose(load_data);
cellpercentage = C{1,6};
matrix = reshape(cellpercentage,1,8);
x = categorical (matrix)
pie(x)
but if I manually write X = [10,45,15,30] size of slices in pie chart followed value X.
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Pie Charts에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!