MathGroup Archive 1999

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Help needed


Bin Liu wrote:
> ... 
> The problem is that the last command (For loop) gives me no output. 
> ...
> 
> For[i=1,i<5,i++,Apply[mag,{Watoms[[i]],Gatoms[[i]]}]]


Hello!
You need to declare a receiving variable:

res = Table[0, {4}];
For[i=1,i<5,i++,res[[i]]=Apply[mag,{Watoms[[i]],Gatoms[[i]]}]]

But you can get rid of the loop anyway:
MapThread[mag,{Watoms,Gatoms}]

Best regards,
Harald


-- 
Harald Giese
Email: giese at dkrz.de
> NEUE TELEFON-NUMMER | NEW PHONE-NUMBER <
Phone: +49 (0)40 42838 5796; Fax: +49 (0)40 5605724
Institut fuer Meereskunde der Universitaet Hamburg
(Institute of Oceanography of the University of Hamburg)
Troplowitzstrasse 7, D-22529 Hamburg


  • Prev by Date: Re:Exporting PRINT results from Mathematica to other applications
  • Next by Date: Re: Q: Can I create a button function ?
  • Previous by thread: Re: Help needed
  • Next by thread: RE: ARghh!!