当前位置:网站首页>Matlab create text cloud
Matlab create text cloud
2022-07-27 10:19:00 【User 9925864】
I used to use python Made a text cloud (Python stylecloud Make cool cloud pictures of words ), This time matlab Have a try
First, prepare the content to a txt In the document , This article takes matlab As an example , Use fileread Function from txt Read text from .
>> contents= fileread('matlab.txt');
>> contents
Use string Function to convert text to a string . then , Use splitlines Break the function by the line break character .
contents= string(contents);
contents= splitlines(contents);
contents(10:14)Replace some punctuation characters with spaces .
p = ["." "?" "!" "," ";" ":"];
contents= replace(contents,p," ");
contents(10:14)take contents Split into an array of strings whose elements contain a single word . To do this , You need to combine all the string elements into one 1×1 character string , Then split it at the blank characters .
contents = join(contents);
contents= split(contents);Delete words less than five characters .
contents(strlength(contents)<5) = [];take contents Convert to classified array , And then use wordcloud Draw . This function draws C The only element of , The size corresponds to the frequency count of these elements .
C = categorical(contents);
figure
wordcloud(C);
title("Matlab Word Cloud")边栏推荐
- Acl2021 best paper released, from ByteDance
- 如何创建一个带诊断工具的.NET镜像
- Learn typescript (1)
- Configuration of pytorch deep learning environment based on cuda10.0
- 01_ Movie recommendation (contentbased)_ Object portrait
- Matlab-实时编辑器介绍
- Failure of CUDA installation nsight visual studio edition failed
- 数据库操作基础语句
- File upload of native input tag
- Shell process control (emphasis), if judgment, case statement, let usage, for ((initial value; loop control condition; variable change)) and for variable in value 1 value 2 value 3..., while loop
猜你喜欢

QT learning (II) -- a brief introduction to QT Creator

Failure of CUDA installation nsight visual studio edition failed

程序的翻译和执行,从编辑、预处理、编译、汇编、链接到执行

Pygame: alien invasion

PCL各模块概述(1.6)

There is no CUDA option in vs2019+cuda11.1 new project

Configuration of pytorch deep learning environment based on cuda10.0

Anchor Free检测器:CenterNet

Reason for pilot importerror: cannot import name 'pilot_ Version 'from' PIL ', how to install pilot < 7.0.0

3D修复论文:Shape Inpainting using 3D Generative Adversarial Network and Recurrent Convolutional Networks
随机推荐
线代004
Xiandai 004
Anchor Free检测器:CenterNet
Oracle 11g manual memory management
Visual slam lecture notes (I): Lecture 1 + Lecture 2
Word2vec principle and application and article similarity (recommended system method)
Dcgan paper improvements + simplified code
pillow的原因ImportError: cannot import name ‘PILLOW_VERSION‘ from ‘PIL‘,如何安装pillow<7.0.0
hugo学习笔记
使用 LSM-Tree 思想基于.NET 6.0 C# 写个 KV 数据库(案例版)
Ant advanced task
使用 Kmeans聚类实现颜色的分割
ORACLE 11g手动内存管理
Live countdown 3 days sofachannel 29 P2P based file and image acceleration system Dragonfly
Pytorch installation (very detailed)
StyleGAN论文笔记+修改代码尝试3D点云生成
Metaspolit
Matlab- draw superimposed ladder diagram and line diagram
Matlab绘制不同阻尼下的系统响应
数学推理题:张王李赵陈五对夫妇聚会,见面握手