vector of strings to cell array
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I have a list of numbers as strings that I want to assign to a cellarray. I currently just do a for loop to make the assignment but want to know if there is a vectorized way to do it.
A = [1 2 3 4 5 6]';
strA = num2str(A);
B = cell(6,1);
for i=1:length(A)
B{i} = strA(i);
end
0 Kommentare
Akzeptierte Antwort
Azzi Abdelmalek
am 7 Mär. 2013
B=arrayfun(@num2str,A,'un',0)
2 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Characters and Strings finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!