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 2002

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

Search the Archive

Re: Import variable and data

  • To: mathgroup at
  • Subject: [mg32706] Re: [mg32682] Import variable and data
  • From: BobHanlon at
  • Date: Thu, 7 Feb 2002 05:09:32 -0500 (EST)
  • Sender: owner-wri-mathgroup at

In a message dated 2/6/02 6:07:58 AM, mvdv at writes:

>I'm having trouble with the following variable and data import:
>The import file is input.txt:
>a b c d
>1 23 45 678
>This all works OK.
>Head[..]  indicates the a,b,c and d are strings, which is fine, because
>ToExpression[..] changes them to symbols.  What I'd like to do is use
>inputData to do the following:
>However, if I try
>ToExpression[ inputData[[1]] ] = inputData[[2]]
>I get an error:
>Set::write: Tag ToExpression in ToExpression[a] is Protected.
>If I then enter 'a' in Mathematica I do not get 1 returned!  No matter
>how I try I
>can't work it so that when I enter the symbol 'a' in Mathematica I get
>the value
>from inputData[[2]].


{HoldFirst, Protected, SequenceHold}

The lhs must be evaluated


Bob Hanlon
Chantilly, VA  USA

  • Prev by Date: Re: The prime factors of n.
  • Next by Date: Re: file.txt and/or file.xls to take file in Mathematica
  • Previous by thread: Re: Import variable and data
  • Next by thread: Re: Import variable and data