Hi
If I have a cell array such as c = {'word1','word2'}
How can I take this and convert it into a 1x1 cell that has all the words in the 1 cell but seperated by a space? Is this possible?
So say the 1x1 matrix would be: word1 word2
Thanks
edit: cell2mat doesnt give me the space in between. it does "word1word2"

댓글 수: 1

Since R2016b:
c = {'word1','word2'}
c = 1×2 cell array
{'word1'} {'word2'}
join(c)
ans = 1×1 cell array
{'word1 word2'}

댓글을 달려면 로그인하십시오.

답변 (2개)

Oleg Komarov
Oleg Komarov 2012년 3월 1일

1 개 추천

This is one way:
c2 = deblank(sprintf('%s ',c{:}));

카테고리

도움말 센터File Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

태그

질문:

2012년 3월 1일

댓글:

2023년 12월 1일

Community Treasure Hunt

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

Start Hunting!

Translated by