Azzera filtri
Azzera filtri

Concatenating horizontally two cell arrays

5 visualizzazioni (ultimi 30 giorni)
wesso Dadoyan
wesso Dadoyan il 16 Ott 2017
Modificato: KL il 16 Ott 2017
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

Risposte (1)

KL
KL il 16 Ott 2017
Modificato: KL il 16 Ott 2017
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.

Categorie

Scopri di più su Creating and Concatenating Matrices in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by