Word Cloud (词云) - Matlab
发布日期:2021-05-09 09:08:20 浏览次数:17 分类:博客文章

本文共 1903 字,大约阅读时间需要 6 分钟。

��������������������� Word Cloud ��������������������������� Matlab ��������� word cloud���Matlab R2018b ������������ [wordcloud](https://www.mathworks.com/help/matlab/ref/wordcloud.html) ������������������������������������
##### >> Create Word Cloud via Matlab

  1. ���������������

������������������������������������������ Word Cloud History.txt ���������������

  1. ������������������������������
%read txt as a stringtext = string(fileread('C:\Users\yuki\Desktop\WordCloudHistory.txt'));%delete puchuationpunctuationCharacters = ["." "?" "!" "," ";" ":"];text = replace(text,punctuationCharacters," ");%convert a string to arraywords = split(join(text));%delete the words has less than 5 characters, which are problely stop wordswords(strlength(words)<5) = [];%change all words to lowercasewords = lower(words);
  1. ������������������������������
%calculate the frequencies for every word[numOccurrences,uniqueWords] = histcounts(categorical(words));
  1. ������ word cloud���
figure%set properties for word cloudwordcloud(uniqueWords,numOccurrences,'Shape', "rectangle", 'MaxDisplayWords', 200);title("Word Cloud History")

##### >> Notes

  1. Matlab ������������������������������������������������������������������������

  2. ���������������������������������������������������������������������������������������������������������������������

Tool Easy Use Free Need Script
Python   Clear document, powerful text mining library   Yes   Yes
JavaScript   Need to extract array by own, and need to find a way to save the image   Yes   Yes
R   Clear document, powerful text mining library   Yes   Yes
Matlab   Clear document, interactive interface   No   Optional
##### >> Sample Code

##### >> Related Blogs

1. [Word Cloud (������) - Python](https://www.cnblogs.com/yukiwu/p/10967037.html)2. [Word Cloud (������) - JavaScript](https://www.cnblogs.com/yukiwu/p/10968816.html)3. [Word Cloud (������) - R](https://www.cnblogs.com/yukiwu/p/10969250.html)
上一篇:How to Compare Means (均值比较)
下一篇:Word Cloud (词云) - R

发表评论

最新留言

初次前来,多多关照!
[***.217.46.12]2025年05月02日 18时41分07秒

关于作者

    喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!

推荐文章