How to prevent cell array within cell array
11 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Cheerful
il 19 Lug 2016
Commentato: Guillaume
il 19 Lug 2016
Dear Experts
I have two cell arrays. One cell array is a combination of another cell array.
name = { 'Tom', 'Tim'};
record = {'school', 'class', name};
Output becomes nested cell arrays. Desired Output:
record = {'school', 'class', 'Tom', 'Tim'}
Thank you for your help
1 Commento
Risposta accettata
Azzi Abdelmalek
il 19 Lug 2016
It's simply
name = { 'Tom', 'Tim'};
record = [{'school', 'class'}, name]
1 Commento
Guillaume
il 19 Lug 2016
Of all, the answers here, this is the most appropriate. What is being asked is simply the concatenation of two cell arrays.
So:
x = [cellarray1, cellarray2];
Più risposte (2)
Star Strider
il 19 Lug 2016
This works:
name = { 'Tom', 'Tim'};
record = {'school', 'class', name};
record2 = {record{1:2}, record{3}{1:2}};
record2 =
'school' 'class' 'Tom' 'Tim'
0 Commenti
Vedere anche
Categorie
Scopri di più su Cell Arrays 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!