Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2006

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

Search the Archive

Re: save value in array during loop

  • To: mathgroup at smc.vnet.net
  • Subject: [mg70501] Re: save value in array during loop
  • From: "Jens-Peer Kuska" <kuska at informatik.uni-leipzig.de>
  • Date: Wed, 18 Oct 2006 04:16:42 -0400 (EDT)
  • Organization: Uni Leipzig
  • References: <eh20uf$2nj$1@smc.vnet.net>

Hi,

UserFunction[x_] := rho

V = Table[0, {13}];

For[i = 0, i <= 12,
rho = i*25;
V[[i + 1]] = UserFunction[0.5];
i++]

work as expected and the V list has stored all the

rho values.

Regards

  Jens

<schaa at geo.uni-koeln.de> schrieb im Newsbeitrag 
news:eh20uf$2nj$1 at smc.vnet.net...
| Hi there,
|
| I am new to mathematica and I have the following 
problem:
|
| save a certain value in an array calculated 
during a loop.
|
| My attempt:
|
| For[i=0,i<=12,
|   rho = i*25;
|   V[[i]] = UserFunction[0.5];
|   i++]
|
| rho has the role of a global variable and is 
used in several other functions.
| UserFunction stands for a function which in turn 
calls other functions.
| V is the array of dimension 13 from 0 to 12.
|
| The code above does not work. What needed to be 
changed to make it
| work?
|
| Thanks a lot
| -Ralf
| 



  • Prev by Date: damped oscilations data fit
  • Next by Date: Re: Dimensional analysis package
  • Previous by thread: Re: save value in array during loop
  • Next by thread: Re: save value in array during loop