필터 지우기
필터 지우기

how can i do a histogram ?

조회 수: 1 (최근 30일)
Armina Petrean
Armina Petrean 2023년 5월 16일
답변: Askic V 2023년 5월 16일
i have the frequency of some word who appear in a text and i want to do the histogram of them.

답변 (1개)

Askic V
Askic V 2023년 5월 16일
For the paricular case, I think bar function would be more appropriate.
text = "In the realm of possibilities, actions speak louder than words." +...
"Faith is the guiding force that propels us to act with conviction." +...
"Through acts of kindness and faith, we can make a difference.";
words = ["act", "faith"];
for i = 1:numel(words)
word_counts(i) = numel(strfind(lower(text), words{i}));
end
bar(word_counts);
xticks(1:numel(words));
xticklabels(words);
title('Histogram of Specific Words');
xlabel('Words');
ylabel('Frequency');

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

태그

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by