How to make a={'1','2','3','4'} to b={'1234'}

16 次查看(过去 30 天)
a={'1','2','3','4'}
make to b={'1234'}

采纳的回答

Wan Ji
Wan Ji 2021-9-1
The simple way is
a={'1','2','3','4'};
b = {[a{:}]}
Answer
b =
1×1 cell array
{'1234'}

更多回答(2 个)

Walter Roberson
Walter Roberson 2021-9-1
编辑:Walter Roberson 2021-9-1
a={'1','2','3','4'}
a = 1×4 cell array
{'1'} {'2'} {'3'} {'4'}
B = {strjoin(a, '')}
B = 1×1 cell array
{'1234'}

stozaki
stozaki 2021-9-1
编辑:stozaki 2021-9-1
Hi,
a = {'1','2','3','4'};
b = cellstr(replace(strjoin(a),' ',''))
b = 1×1 cell array
{'1234'}

类别

Help CenterFile Exchange 中查找有关 Characters and Strings 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by