Hi David and others
This is small speed test:
function t = test( s )
t = time;
c=cell( s, 1 );
r = rand( 8, 1 );
c{:,1} = r;
cc = cell2mat( c );
t = time - t;
end
octave:4> test( 1000 )
ans = 0.27966
octave:5> test( 10000 )
ans = 12.347
octave:6> test( 13000 )
ans = 26.865
octave:3> test( 16000 )
ans = 47.761
octave:4> test( 19000 )
ans = 83.082
As it seems, each adding of 3000 elements doubles the time it needs to convert
cell to matrix.
I believe the slowness is due to the recursive scripting nature of the
cell2mat.m function.
I thought I will write a small conversion program in C with limited capabilities for my own needs
( ie. only c{i,1} =matrix will be handled ) but I am so much confused with the interface of the
Cell class.
( NB: if I replace cell2mat with cellfun( c, "mean" ) I would get:
octave:10> test( 20000 )
ans = 8.0793
and this increases linearly with size of the cell array)
Thank you very much in advance,
Levente