combine cell data into column

 采纳的回答

M = vertcat(C{:});
where C is your cell array; M will be your big column vector.

更多回答(1 个)

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:

1 个评论

thanks, this was what I was looking for. One more question: if my cell dataset would be two cell row and I wanted two tall colums vector, how would you do that?

请先登录,再进行评论。

类别

帮助中心File Exchange 中查找有关 Matrix Indexing 的更多信息

产品

版本

R2022b

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by