How to create pie chart using input from text file?
15 ビュー (過去 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!