How to speed up data processing when extracting from a large cell array?
2 ビュー (過去 30 日間)
古いコメントを表示
I am dealing with a large cell array (e.g., 3826341x1 cell). I would like merge the data or matrix from each cell. Using 'cell2mat' takes so much of time. Is there any alternative to cell2mat to process the data faster? Any leads will be highly appreciated. Thanks.
5 件のコメント
Dyuman Joshi
2023 年 9 月 19 日
load('array.mat')
whos
f1=@(x) cell2mat(x);
f2=@(x) vertcat(x{:});
f3=@(x) cat(1,x{:});
F1 = @()f1(alphaClusterAll);
F2 = @()f2(alphaClusterAll);
F3 = @()f3(alphaClusterAll);
fprintf('Time taken by cell2mat = %f seconds', timeit(F1))
fprintf('Time taken by vertcat = %f seconds', timeit(F2))
fprintf('Time taken by cat = %f seconds', timeit(F3))
isequal(F1(),F2(),F3())
You can try this FEX submission - Cell2Vec
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!