string and variables bar plot
17 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hello every one,
I would like to make a bar graph or something same.
I have cases from 1 up to 18
and each case depending on the problems refers to three categoris(A,B,C).
I do not know how to plot the bar graph, could you please help me with dommands.
thanks.
example
x=1:1:18;
categories= ['A','B','C']
% after soving the problem,
A consists of x numbers from 8-15
B consists of x numbers from 16-18
C consists of x numbers from 1-7
or these distribution can be random.
0 Commenti
Risposte (2)
Walter Roberson
il 21 Dic 2021
Modificato: Walter Roberson
il 21 Dic 2021
categories = {'A','B','C'};
N = 50;
x = randi(18, 1, N);
cats = categorical(categories);
C = discretize(x, [1, 8, 16, 18]);
counts = accumarray(C(:), 1);
bar(cats, counts)
0 Commenti
Vedere anche
Categorie
Scopri di più su Discrete Data Plots in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!