当前位置:网站首页>Matlab-创建文字云
Matlab-创建文字云
2022-07-27 09:57:00 【用户9925864】
之前用python制作过文字云(Python stylecloud制作酷炫的词云图),这次用matlab试一下
首先把内容准备到一个txt文件里面,本文以matlab的介绍为例子,使用 fileread 函数从txt中读取文本。
>> contents= fileread('matlab.txt');
>> contents
使用 string 函数将文本转换为字符串。然后,使用 splitlines 函数按换行符对其进行拆分。
contents= string(contents);
contents= splitlines(contents);
contents(10:14)用空格替换一些标点字符。
p = ["." "?" "!" "," ";" ":"];
contents= replace(contents,p," ");
contents(10:14)将 contents拆分为其元素包含单个单词的字符串数组。要完成此操作,需要将所有字符串元素合并成一个 1×1 字符串,然后在空白字符处进行拆分。
contents = join(contents);
contents= split(contents);删除少于五个字符的单词。
contents(strlength(contents)<5) = [];将 contents转换为分类数组,然后使用 wordcloud 进行绘图。此函数绘制 C 的唯一元素,大小与这些元素的频率计数对应。
C = categorical(contents);
figure
wordcloud(C);
title("Matlab Word Cloud")边栏推荐
- LeetCode.814. 二叉树剪枝____DFS
- C # set different text watermarks for each page of word
- 视觉SLAM十四讲笔记(一):第一讲+第二讲
- 语音识别的一些开源项目整理
- 直播倒计时 3 天|SOFAChannel#29 基于 P2P 的文件和镜像加速系统 Dragonfly
- NFS 服务器的搭建
- pytorch的安装(非常详细)
- Metasploit-永恒之蓝攻击
- RobotFramework+Eclispe环境安装篇
- After one year, the paper was finally accepted by the international summit
猜你喜欢

并发之park与unpark说明

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

Acl2021 best paper released, from ByteDance

LeetCode.1260. 二维网格迁移____原地暴力 / 降维+循环数组直接定位

Anaconda安装(非常详细)
![Shell的正则表达式入门、常规匹配、特殊字符:^、$、.、*、字符区间(中括号):[ ]、特殊字符:\、匹配手机号](/img/31/ed0d8c1a5327059f2de7493bec1c6c.png)
Shell的正则表达式入门、常规匹配、特殊字符:^、$、.、*、字符区间(中括号):[ ]、特殊字符:\、匹配手机号

Qt 学习(二) —— Qt Creator简单介绍

open3d库的安装,conda常用指令,导入open3d时报这个错误Solving environment: failed with initial frozen solve. Retrying w

Configuration of pytorch deep learning environment based on cuda10.0

3D修复论文:Shape Inpainting using 3D Generative Adversarial Network and Recurrent Convolutional Networks
随机推荐
Case of burr (bulge) notch (depression) detection of circular workpiece
01_ Movie recommendation (contentbased)_ Object portrait
StyleGAN论文笔记+修改代码尝试3D点云生成
备战金九银十Android面试准备(含面试全流程,面试准备工作面试题和资料等)
Food safety | is sugar free really sugar free? These truths need to be known
Nacos configuration center dynamically refreshes the data source
Ant advanced -path and fileset
samba服务器
Matlab绘制不同阻尼下的系统响应
Matlab-实时编辑器介绍
hdu5289(Assignment)
RobotFramework+Eclispe环境安装篇
女粉想要找男朋友,竟是为了...
hdu5288(OO’s Sequence)
pillow的原因ImportError: cannot import name ‘PILLOW_VERSION‘ from ‘PIL‘,如何安装pillow<7.0.0
There is no CUDA option in vs2019+cuda11.1 new project
Stylegan paper notes + modify code to try 3D point cloud generation
历时一年,论文终于被国际顶会接收了
Anaconda安装(非常详细)
GBase 8a MPP集群扩容实战