Histogram in App Designer

5 visualizzazioni (ultimi 30 giorni)
Diogo Costa
Diogo Costa il 3 Lug 2020
So I have this excel file and i want to make an histogram or scatter in app desginer for smoke and non smoker, can someone help me out ? I can't figure it out, because in the excel Smoker is just one column, and i want to make a histogram with 2 bars (different colours), one is for the smokers, and the other one is for non smokers.
  9 Commenti
Diogo Costa
Diogo Costa il 3 Lug 2020
So I have this, but only turns the bars in red, and that's is not what i want, i want each bar with each color
t = readtable("Pacientes.xlsx","Sheet",1);
app.UITable.Data = t;
x = table2array(t(:,"Smoker"));
C = categorical(x,[1 0],{'Smoker','Non Smoker'})
h = histogram(app.UIAxes2,C,'BarWidth',0.5,'FaceColor',"r")
legend(h(:), {'Smoker' 'Non Smoker'},'Location','northwest')
Rik
Rik il 3 Lug 2020
I don't think that is possible with histogram, so you will have to create two bar objects.

Accedi per commentare.

Risposte (1)

Harry Smith
Harry Smith il 18 Giu 2022
This may help:
histogram(app.histogramPlot,data)
  1 Commento
Gligan Miron Marius
Gligan Miron Marius il 18 Mag 2023
Yes, in my case it works correctly.
...
I_hist=histogram(app.Hist, I_rgb);
...

Accedi per commentare.

Categorie

Scopri di più su Data Distribution 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!

Translated by