当前位置:网站首页>Use of join function in MATLAB
Use of join function in MATLAB
2022-07-25 18:09:00 【jk_ one hundred and one】
Catalog
Combine the elements of the string array with delimiters
Merges an array of strings along a specified dimension
join The function is to merge strings .
grammar
newStr = join(str)
newStr = join(str,delimiter)
newStr = join(str,dim)
newStr = join(str,delimiter,dim)explain
newStr = join(str) By joining successive elements of the input array , Place a space character between them , So that str The text in is merged .str It can be a string array or a character vector cell array .newStr The data type of is related to str identical .
If str yes 1×N or N×1 String array or cell array , be newStr Is a string scalar or a cell array containing a character vector .
If str yes M×N String array or cell array , be newStr yes M×1 String array or cell array .
For any size string array or cell array ,join The size of the edge is not equal to 1 The last str Dimension concatenation element .
newStr = join(str,delimiter) take str Merge the text in , And in str Between the elements of delimiter The elements of , Instead of space characters .
If delimiter Parameters are arrays of different delimiters , and str There are N Elements , be delimiter In the same dimension, there must be N–1 Elements .delimiter The size of other dimensions of must be 1 Or with str The corresponding dimension size of is the same .
newStr = join(str,dim) take str The elements in along the dimension dim combined .
newStr = join(str,delimiter,dim) take str The elements in along the dimension dim combined , And in str Between the elements of delimiter The elements of .
Example
Merge strings in string array
Create an array of strings . from R2017a Start , You can use double quotation marks to create a string .
str = ["Carlos","Sada";
"Ella","Olsen";
"Diana","Lee"]
str = 3x2 string
"Carlos" "Sada"
"Ella" "Olsen"
"Diana" "Lee"
Use join Function to merge strings .join Series connection str String in , And place space characters between strings .join Cascade along the second dimension , Because this is the size is not equal to 1 The last dimension of .
newStr = join(str)
newStr = 3x1 string
"Carlos Sada"
"Ella Olsen"
"Diana Lee"
Combine the elements of the string array with delimiters
Merge the elements in the string array . stay str Insert different text segments between strings in , Not spaces . Create an array of strings . from R2017a Start , You can use double quotation marks to create a string .
str = ["x","y","z";
"a","b","c"]
str = 2x3 string
"x" "y" "z"
"a" "b" "c"
Concatenate strings with dashes .
newStr = join(str,"-")
newStr = 2x1 string
"x-y-z"
"a-b-c"
Concatenate strings with symbols , Make the output string represent the equation .delimiters Parameter must be 2×2 Array , because str yes 2×3 Array .
delimiters = [" + "," = ";
" - "," = "];
newStr = join(str,delimiters)
newStr = 2x1 string
"x + y = z"
"a - b = c"
Merges an array of strings along a specified dimension
Create an array of strings . from R2017a Start , You can use double quotation marks to create a string .
str = ["Carlos","Sada";
"Ella","Olsen";
"Diana","Lee"]
str = 3x2 string
"Carlos" "Sada"
"Ella" "Olsen"
"Diana" "Lee"
Merge along the first dimension str String in . By default ,join Function edge size is not equal to 1 The last dimension of the merge string . To merge strings along the first dimension , Please specify it as an additional input parameter .
newStr = join(str,1)
newStr = 1x2 string
"Carlos Ella Diana" "Sada Olsen Lee"Input parameters
str - Input text
Input text , Specify as string array or character vector cell array .
delimiter - Separator used to join strings
Separator used to join strings , Specify as character vector 、 Character vector cell array or string array .join The output string array is formed by joining string elements with delimiters .
join take delimiter All characters in are inserted as literal text , Include escape character sequences .
dim - The dimension along which the string is joined
Join dimension of string , Specify as a positive integer . If you don't specify dim, The default value is that the size is not equal to 1 The last dimension of .
Output parameters
newStr - The output text
The output text , Returns as a string array or a character vector cell array .newStr The data type of is the same as the input text , The size of the join dimension is 1.
边栏推荐
- RedisTemplate解决高并发下秒杀系统库存超卖方案 — Redis事务+乐观锁机制
- Go channel simple notes
- 图的相关操作
- BL602 开发环境搭建
- Cloud VR: the next step of virtual reality specialization
- 2022/7/23
- List conversion problem
- MySQL lost the previous 0 after the decimal number type select
- List转换问题
- TESTNG中的并发测试invocationCount, threadPoolSize, timeOut的使用
猜你喜欢

云流化和云桌面有什么关系

Memory and packet buffer management of LwIP

imx6 RTL8189FTV移植

What are the advantages of real-time cloud rendering

ORB_SLAM3复现——上篇

Wu Enda's machine learning programming operation cannot be suspended pause problem solved

SLA 、SLO & SLI
![[MySQL]数据库中的索引为什么是用B+树来实现? 哈希表/红黑树/B树是否可行呢?](/img/1f/a2d50ec6bc97d52c1e7566a42e564b.png)
[MySQL]数据库中的索引为什么是用B+树来实现? 哈希表/红黑树/B树是否可行呢?

Landmark buildings around the world

Li Kai: the interesting and cutting-edge audio and video industry has always attracted me
随机推荐
Postman get started quickly
Mysql database common commands
Recognized by international authorities! Oceanbase was selected into the Forrester translational data platform report
TME2022校园招聘后台开发/运营开发/业务运维/应用开发笔试(I)编程题的一点自我分析
Use of C language cjson Library
Why is the index in [mysql] database implemented by b+ tree? Is hash table / red black tree /b tree feasible?
C语言 整数与字符串的相互转换
Brief introduction of bubble sort and quick sort
Creation of unity Bezier curve
UFT(QTP)-总结点与自动化测试框架
Basic operation of bidirectional linked list
为什么数字化未来取决于3D实时渲染
Mock服务moco系列(三)- 重定向、正则表达式、延迟、模板、事件、分模块设计
Stm32f105rbt6 internal flash debugging
Joseph Ring problem
Who is responsible for the problems of virtual idol endorsement products?
H5 test point (mind map)
Idea integrates common functions of SVN code management
SDLC software development life cycle and model
云VR:虚拟现实专业化的下一步