필터 지우기
필터 지우기

Concatenating horizontally two cell arrays

조회 수: 5 (최근 30일)
wesso Dadoyan
wesso Dadoyan 2017년 10월 16일
편집: KL 2017년 10월 16일
Hi,
A{1,1}=00016510;
B{1,1}=0;
C=horzcat(A{1,1},B{1,1});% is giving C=00016510 (1x9 char although 8 digits appear)
C=horzcat(A,B);%gives C= '00016510' [0] (1×2 cell array)
I am wondering how to concatenate the two cells horizontally to get 000165100

답변 (1개)

KL
KL 2017년 10월 16일
편집: KL 2017년 10월 16일
If you want to retain the zeros in the beginning why not store them as char?
A{1,1}='00016510';
B{1,1}='0';
C=horzcat(A{1,1},B{1,1})
WHy are you using cell array anyway?! I suppose in your actual problem, using cell array makes sense.

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by