How to generate histogram from a given (x,y) dataset?
19 次查看(过去 30 天)
显示 更早的评论
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]
0 个评论
回答(1 个)
Walter Roberson
2022-9-21
filename = 'https://www.mathworks.com/matlabcentral/answers/uploaded_files/1131165/xy.xlsx';
data = readmatrix(filename);
bar(data(:,1), data(:,2))
5 个评论
Walter Roberson
2022-9-29
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.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Axes Appearance 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!