How to combine n cell arrays into one giant one?
3 ビュー (過去 30 日間)
古いコメントを表示
Hello,
I have a 12-by-190 cell array dataset, each contains either a 1-by-504 cell array or a 1-by-336 cell array. Each of these cell array contains a vector of size of either 600-by-1 or 300-by-1.
As for labels, I have a 12-by-190 cell arrays that each cell contains either a 1-by-504 cell array or a 1-by-336 cell array.
I'd like to concatenate all of the cells together into one giant cells (or preferably a giant matrix) and a corresponding array of labels.
How can I do that?
Thanks in advance
0 件のコメント
回答 (1 件)
SALAH ALRABEEI
2021 年 6 月 7 日
I think you need to loop a bit since you have cells of cells. Let A and B are ur outer cell matrices, data and labels
% Try this
NA=[];
NB =[];
for i = length(A)
a = [A{i}{:}];
b = [B{i}{:}];
NA = [NA,a(:)];
NB = [NB,b(:)];
end
2 件のコメント
参考
カテゴリ
Help Center および File Exchange で Matrices and Arrays についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!