haibaraxx的个人博客分享 http://blog.sciencenet.cn/u/haibaraxx

博文

Matlab: concatenate two strings

已有 2012 次阅读 2016-8-17 23:08 |个人分类:Matlab|系统分类:科研笔记| Two, strings, concatenate

a='Good'; b='Morning';

firstnames=('Maira';'John');

lastnames=('Green';'Smith');


Syntax: c1=strcat(a,b);

           names1=strcat(n1,n2);


Output: c1->

               'GoodMorning'

           names1->

               'MariaGreen'

               'JohnSmith'


Syntax: c2=strcat(a,{' '},b); % there is a backspace inside {' '}.

            names2=strcat(n1,{', '},n2); % there are one comma and one backspace inside {' '}.

Output: c2->

               'Good Morning'

           names2->

               'Maria, Green'

               'John, Smith'




https://blog.sciencenet.cn/blog-3031432-997089.html

上一篇:Matlab: 查找多个元素在矩阵中的位置
下一篇:Matlab: list folder contents
收藏 IP: 134.1.1.*| 热度|

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-9-27 08:05

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部