help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

lists vs cell arrays


From: Bertrand Roessli
Subject: lists vs cell arrays
Date: Wed, 22 Aug 2007 09:39:49 +0200

Hello,

Because 'lists' are deprecated in Octave and not implemented in Matlab,
I am trying to replace all the 'lists' by 'cell' and also to vectorise
the code as much as possible. 

However, comparison of the following pieces of code

tic;
[cell2mat(moment_cell).rm].*cos([cell2mat(moment_cell).rtheta]/180*pi);
toc

tic;
for i=1:nth(moment_list,1)
        nth(moment_list,i+1).rm*cos(nth(moment_list,i+1).rtheta/180*pi);
endfor
toc

yields 

Elapsed time is 0.044952 seconds.
and
Elapsed time is 0.000488 seconds.

(Octave 2.9.9)

Is there a way to 'accelerate' [cell2mat]?

Thank you,

Bertrand Roessli 

-- 
Dr. Bertrand Roessli
Laboratory for Neutron Scattering
Paul Scherrer Institut and ETH Zurich
CH-5232 Villigen PSI

Tel.: +41 56 310 44 01



reply via email to

[Prev in Thread] Current Thread [Next in Thread]