MathGroup Archive 1999

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

Search the Archive

Re: Help needed

  • To: mathgroup at smc.vnet.net
  • Subject: [mg18879] Re: Help needed
  • From: Harald Giese <giese at dkrz.de>
  • Date: Sun, 25 Jul 1999 03:30:13 -0400
  • Organization: Institut fuer Meereskunde, Universitaet Hamburg
  • References: <7n68an$gt2@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

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!!