combine cell data into column
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Lotte Piek
am 27 Feb. 2023
Kommentiert: Stephen23
am 27 Feb. 2023
Hi everyone,
I have a cell data set as can be seen in the attached picture. I would like to make one big column/array with all the values from the cells.
Can anybody help?
Akzeptierte Antwort
Voss
am 27 Feb. 2023
M = vertcat(C{:});
where C is your cell array; M will be your big column vector.
Weitere Antworten (1)
Image Analyst
am 27 Feb. 2023
Do you want a single very tall column vector, or a 2-D matrix with each column vector in its own column?
Did you try a simple for loop?
for k = 1 : numel(ca) % ca is your cell array
thisCellContents = ca{k};
if ~isempty(thisCellContents)
if k == 1
columnVector = thisCellContents;
else
columnVector = [columnVector; thisCellContents];
end
end
end
If you have any more questions, then attach your data and code to read it in with the paperclip icon after you read this:
Siehe auch
Kategorien
Mehr zu Logical 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!