Adding numerical array to cell array
Mostra commenti meno recenti
I have a cell array of the form:
C={'Tom', 'Student', 'Jim', 'Faculty', 'Clare', 'Student'}
and a numerical array of the form:
N=[100 120 140 160 180 200]
How can I create a new cell array where N is placed somewhere inbetweem the elements of C, e.g.
C={'Tom', 'Student', '100' '120', '140', '160', '180', '200', 'Jim', 'Faculty', 'Clare', 'Student'}
I tried this:
N=strsplit(num2str([100 120 140 160 180 200]))
C={'Tom', N, 'Student', 'Jim', 'Faculty', 'Clare', 'Student'}
xlswrite('tempp.xls',C)
But the output is:
N =
1×6 cell array
'100' '120' '140' '160' '180' '200'
C =
1×7 cell array
'Tom' {1×6 cell} 'Student' 'Jim' 'Faculty' 'Clare' 'Student'
What I am doing wrong?
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Matrices and Arrays in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!