Calculating log for each array element

David Bateman David.Bateman at motorola.com
Fri Jun 20 08:30:08 CDT 2008


DimitryASuplatov wrote:
> Hello,
>
> I have array with some values initialized as
>
> a = load <filename>
>
> I want now to create another array b so as b[i] = log(a[i])
> I do this as follows
>
> for i = 1:length(a)
> 	b(i) = log(a(i))
> endfor
>
> This works but it takes to long
>
> 1/ Is there any way to speed this up?
> 2/ How to convert my array a to list?
> 3/ How to append to array?
>
> I really appreciate your help!
> Thank you!
>
> SDA
>
>   
what's wrong with "b = log(a)"?

D.

-- 
David Bateman                                David.Bateman at motorola.com
Motorola Labs - Paris                        +33 1 69 35 48 04 (Ph) 
Parc Les Algorithmes, Commune de St Aubin    +33 6 72 01 06 33 (Mob) 
91193 Gif-Sur-Yvette FRANCE                  +33 1 69 35 77 01 (Fax) 

The information contained in this communication has been classified as: 

[x] General Business Information 
[ ] Motorola Internal Use Only 
[ ] Motorola Confidential Proprietary



More information about the Help-octave mailing list