Using While Loop For Grouping Pie chart "Slices"
Afficher commentaires plus anciens
Hello I am writing a script for a pie chart for reaction timings from a game. I want the pie chart to depict the occurrances of different reaction speeds. I have an array 'x' with all the speeds and I wanted to catagorize them using a "while loop" and plotting these grouped variables as a pie chart. But I am having errors can someone please help me.
x= [0.66,0.38,0.01,0.01,0.13,0.01,1.38,3.96,1.04,0.01,0.39,0.38,0.36,0.32,2.61,2.73,0.01,0.95,1.94,0.01,0.01,1.18,1.42,0.01,0.37,0.45,0.01,3.31,0.77,0.04,1.45,1.38,1.00,0.03,3.05];
int n = 1;
int a = 0;
int b = 0;
int c = 0;
int d = 0;
int f = 0;
while (n<x) {
if(x==.01){
a++;
}
if(.01<=x<=.25){
b++;
}
if(.25<=x<=.75){
c++;
}
if(.75<=x<=1.0){
d++;
}
if(x>1){
f++;
}
n++;
}
h=[a,b,c,d,f];
pie(h);
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Pie Charts dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
