Concatenating Arrays end to end 1D
14 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi folks, I am trying to join some 1d arrays together, some with numbers and others with text, but running into some issues.
I have the following:
Blank='-';
FailureCode = 18;
Duplicates = [1;71;91;119;141;155;160;255];
a= cellstr(repmat(Blank, [FailureCode 1]));
e = cat(1, Duplicates, a)
From this, it can be seen that the first cell is an 8x1 double. However I would like a full 1d array where the last value of duplicates joins to the first value of the repeated dash symbol array 'a'.
Hope someone can help!
Thanks,
Calum.
0 Commenti
Risposta accettata
Star Strider
il 22 Ago 2023
One option is to convert ‘Duplicates’ to a cell array (using num2cell) to make it compatible with the other values —
Blank='-';
FailureCode = 18;
Duplicates = [1;71;91;119;141;155;160;255];
a= cellstr(repmat(Blank, [FailureCode 1]));
e = cat(1, num2cell(Duplicates), a)
.
2 Commenti
Star Strider
il 22 Ago 2023
As always, my pleasure!
No worries! I needed to experiment with a couple different approaches to get it to work.
Più risposte (0)
Vedere anche
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!