How to create pie chart using input from text file?

14 visualizaciones (últimos 30 días)
diah atus
diah atus el 13 de Abr. de 2016
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.

Respuestas (0)

Categorías

Más información sobre Pie Charts en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by