如何将1x1单元转换为字符串?
6,154次观看(最近30天)
节目older comments
如何将1x1单元格转换为{
'
线
'
} to a character vector like
'
线
'
, or a string like
请“线”。谢谢
0 Comments
接受的答案
Azzi Abdelmalek
on 1 Feb 2015
编辑:Mathworks支金宝app持团队
2020年9月3日
To convert a cell array of character vectors to a character array, use the “char” function.
a = {'line'}
b = char(a)
To extract the contents from a cell, index using curly braces.
a = {'line'}
b = a {1}
从R2016B开始,您可以将文本存储在字符串数组中。要将单元格数组转换为字符串数组,请使用“字符串”函数。
a = {'line'}
B = string(A)
更多的Answers (2)
Morteza Darvish Morshedi
2019年6月14日
Even if you have more than 1 string in our cell array, an easy way can be:
S = {'你好',' ','世界'}
ss = [S{:}]
5 Comments
See Also
Categories
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
开始狩猎!