horzcat cell array of string

조회 수: 1 (최근 30일)
Mederic Mainson
Mederic Mainson 2016년 9월 21일
댓글: KSSV 2016년 9월 21일
Hi Guys, I am a bit buffled, it shouldnt be so hard. I have a cell array of strings, see image below for details. I want to combine the 2 colunms of this cell array into one colunm. i do this:
B=[A{:,1} A{:,2}];
But it combines everything into one unique cell... Help please. Cheers Medie

채택된 답변

Walter Roberson
Walter Roberson 2016년 9월 21일
strcat(A(:,1), {' '}, A(:,2))

추가 답변 (1개)

KSSV
KSSV 2016년 9월 21일
a1 = {'2016/09/20'} ;
a2 = {'03:16:38'} ;
strcat(a1,a2)
  댓글 수: 4
Walter Roberson
Walter Roberson 2016년 9월 21일
That will not leave the customary space between the parts. The strcat I show will add in the space.
KSSV
KSSV 2016년 9월 21일
space can be added using: strcat(a1,{' '},a2). I was thinking he wanted to merge them into single.

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

카테고리

Help CenterFile Exchange에서 Data Types에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by