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

조회 수: 13 (최근 30일)
dmfwlansejr
dmfwlansejr 2021년 9월 1일
편집: Walter Roberson 2021년 9월 1일
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