Effacer les filtres
Effacer les filtres

How to generate histogram from a given (x,y) dataset?

10 vues (au cours des 30 derniers jours)
ct8
ct8 le 21 Sep 2022
Modifié(e) : ct8 le 17 Avr 2024
From a set of x and y values (attached), I am trying to generate a histogram.
histogram(data, nbins, 'Binwidth', 2, 'BinLimits',[0,360], 'DisplayStyle','bar','LineStyle','-','FaceColor',[0.6350 0.0780,0.1840]

Réponses (1)

Walter Roberson
Walter Roberson le 21 Sep 2022
filename = 'https://www.mathworks.com/matlabcentral/answers/uploaded_files/1131165/xy.xlsx';
data = readmatrix(filename);
bar(data(:,1), data(:,2))
  5 commentaires
ct8
ct8 le 29 Sep 2022
The input values are from the .xlsx file.
Walter Roberson
Walter Roberson le 29 Sep 2022
userPrompt = {'Enter the outer diameter', 'Enter the inner diameter', 'Enter the number of color sectors', 'Enter the gray level outside the wheel'};
caUserInput = inputdlg(userPrompt, titleBar, 1, defaultValues);
Unless you have reprogrammed inputdlg(), inputdlg() cannot read from an xlsx file.
Earlier the content of the file was described as being x and y values, not as being inner diameters, outer diameters, and grey levels.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Image Processing Toolbox dans Help Center et File Exchange

Produits


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by