How can I draw a histogram of my data?

1 回表示 (過去 30 日間)
Serhat Sayim
Serhat Sayim 2021 年 4 月 25 日
編集済み: Scott MacKenzie 2021 年 4 月 25 日
I have 1x720 data. I determined my threshold value as 3 for these data. I want to draw a histogram. I want to write as wheeze if the values ​​in this histogram are less than 3, and non wheeze if they are greater than 3. I want it to look like the sample histogram below. How can I do this? Thank you.
  4 件のコメント
Image Analyst
Image Analyst 2021 年 4 月 25 日
Do you want to make it easy for people to help you by attaching your actual data? Or should they just use something like
data = 6 * rand(1, 720);
Serhat Sayim
Serhat Sayim 2021 年 4 月 25 日
here I attached the m form of it.

サインインしてコメントする。

採用された回答

Scott MacKenzie
Scott MacKenzie 2021 年 4 月 25 日
編集済み: Scott MacKenzie 2021 年 4 月 25 日
load data; % loads data into vector mci
threshold = 3;
upper = ceil(max(mci));
d = histcounts(mci, 0:upper);
bar(1:threshold, d(1:threshold), 'facecolor', 'k');
axis([0 upper 0 max(d)*1.05]);
hold on;
bar(threshold+1:upper, d(threshold+1:upper), 'facecolor', 'w');
set(gca,'ticklength', [0 0]);
set(gca,'xtick', 0.5 + 0:upper);
set(gca,'xticklabels', 0:upper);
legend({'wheeze' 'non-wheeze'});
  1 件のコメント
Serhat Sayim
Serhat Sayim 2021 年 4 月 25 日
Thank you.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeHistograms についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by