How to speed up data processing when extracting from a large cell array?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Dyuman Joshi
el 19 de Sept. de 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
Respuestas (0)
Ver también
Categorías
Más información sobre Logical en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!