Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

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

Search the Archive

Re: filling in an array

  • To: mathgroup at
  • Subject: [mg55356] Re: filling in an array
  • From: Peter Pein <petsie at>
  • Date: Sun, 20 Mar 2005 04:11:48 -0500 (EST)
  • References: <d1guie$sc$>
  • Sender: owner-wri-mathgroup at

dumb_founded wrote:
> How can I input values into an array most efficiently?  I tried the
> code below, but it doesn't work.  The kernel starts working through the
> loop and never gets out.
> Array[b, 10];
> For[i = 1, i = 10, b[i] = i/10]
1. If nothing else helps, look at the documetation:

For[start, test, incr, body] executes start, then repeatedly evaluates
body and incr until test fails to give True.

2. to compare the values of two expressions use ==, not =

3. Had a look at the result of Array[b,10]?? Do so.

4. To address the elemnts of a List use b[[i]] not b[i]

5. Just guessing:

For[b=Table[,{10}]; i=1, i<=10, i++, b[[i]]=1/i];


Peter Pein

  • Prev by Date: Re: String to numbers
  • Next by Date: Re: String to numbers
  • Previous by thread: Re: filling in an array
  • Next by thread: Re: filling in an array