Info
Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.
is there any process to convert cell type array to numarical array?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
is there any process to convert a cell type array having 1 column to a matrix where the rows of cell type array will be the rows of the matrix and the component of the cell type array have different no of 1 row component in every column. 1 want that other column where the values does not have should consist of zero. please inform me. thank you in advance.
1 Kommentar
Antworten (1)
Titus Edelhofer
am 6 Jul. 2011
Hi,
if I understand correctly, the answer is no. But it would not be difficult to do:
Acell = {[1 2 3]; [1 2]; [1 2 3 4]};
columns = max(cellfun(@length, Acell));
A = zeros(length(Acell), columns);
for i=1:length(Acell)
A(i, 1:length(Acell{i})) = Acell{i};
end
Titus
4 Kommentare
Titus Edelhofer
am 6 Jul. 2011
Hi Jan,
I understood "where the values does not have should consist of zero" that OP wants to have zeros where no values are given. Instead of zeros of course any other value can be used (e.g. nan).
Titus
Diese Frage ist geschlossen.
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!