help-octave
[Top][All Lists]
Advanced

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

Re: lists vs cell arrays


From: Michael Goffioul
Subject: Re: lists vs cell arrays
Date: Wed, 22 Aug 2007 10:48:28 +0200

On 8/22/07, Bertrand Roessli <address@hidden> wrote:
> 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]?

I don't know if it will be faster, but what about:

[moment_cell{:}]

to create the structure array.

Michael.


reply via email to

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