当前位置:网站首页>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.
边栏推荐
- 专访即构科技李凯:音视频的有趣、行业前沿一直吸引着我
- Good news! Ruiyun technology was awarded the member unit of 5g integrated application special committee of "sailing on the sea"
- 云VR:虚拟现实专业化的下一步
- 2022/7/23
- Li Kai: the interesting and cutting-edge audio and video industry has always attracted me
- Type assertion of go interface variables
- MySQL数据库常用命令
- 为什么数字化未来取决于3D实时渲染
- STM32F105RBT6 内部flash调试
- Basic knowledge of software testing (mind mapping)
猜你喜欢

Tme2022 campus recruitment background development / operation development / business operation and maintenance / application development written examination (I) a little self analysis of programming q

Could not stop Cortex-M device! please check the JTAG cable的解决办法

Keil5 "loading PDSC debug description failed for STMicroelectronics stm32hxxxxxxx" solution

What scenarios have rust, which is becoming more and more mature, applied?

Pan domain name configuration method

How to choose digital twin visualization platform

BiSeNet v1

Cloud VR: the next step of virtual reality specialization

更新|3DCAT实时云渲染 v2.1.2版本全新发布

Could not stop Cortex-M device! Please check the JTAG cable solution
随机推荐
Mysql database common commands
直击考点:PMP考试中常见敏捷知识点汇总
Postman快速上手
UFT(QTP)-总结点与自动化测试框架
How to judge the performance of static code quality analysis tools? These five factors must be considered
mysql的小数number类型select之后丢失了前面的0
LeetCode 101. 对称二叉树 && 100. 相同的树 && 572. 另一棵树的子树
ORB_SLAM3复现——上篇
专访即构科技李凯:音视频的有趣、行业前沿一直吸引着我
排序还需要了解的信息以及链表
「行话」| 用DevOps高效交付游戏,是种什么体验?
Tme2022 campus recruitment background development / operation development / business operation and maintenance / application development written examination (I) a little self analysis of programming q
testng执行顺序的3中控制方法
Drawing PDF form (II) drawing excel form style in PDF through iText, setting Chinese font, watermark, logo, header and page number
关于云XR介绍,以及5G时代云化XR的发展机遇
Keil5 "loading PDSC debug description failed for STMicroelectronics stm32hxxxxxxx" solution
二叉树的相关操作
大话DevOps监控,团队如何选择监控工具?
TME2022校园招聘后台开发/运营开发/业务运维/应用开发笔试(I)编程题的一点自我分析
PageHelper还能结合Lambda表达式实现简洁的分页封装