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

7 views (last 30 days)
dmfwlansejr
dmfwlansejr on 1 Sep 2021
Edited: Walter Roberson on 1 Sep 2021
a={'1','2','3','4'}
make to b={'1234'}

Accepted Answer

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

More Answers (2)

Walter Roberson
Walter Roberson on 1 Sep 2021
Edited: Walter Roberson on 1 Sep 2021
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 on 1 Sep 2021
Edited: stozaki on 1 Sep 2021
Hi,
a = {'1','2','3','4'};
b = cellstr(replace(strjoin(a),' ',''))
b = 1×1 cell array
{'1234'}

Community Treasure Hunt

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

Start Hunting!