How to speed up data processing when extracting from a large cell array?
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Dyuman Joshi
il 19 Set 2023
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
Risposte (0)
Vedere anche
Categorie
Scopri di più su Logical in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!