Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

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

Search the Archive

Re: how to make arrays from text file in mathematica??

  • To: mathgroup at smc.vnet.net
  • Subject: [mg97686] Re: how to make arrays from text file in mathematica??
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Wed, 18 Mar 2009 04:58:12 -0500 (EST)
  • Organization: Uni Leipzig
  • References: <gpnsh0$gs3$1@smc.vnet.net>
  • Reply-to: kuska at informatik.uni-leipzig.de

Hi,


text = "a b 123\nc d 255\ne f 127\n"

ImportString[text, "Table"]

will do it.

Regards
   Jens

Nishant wrote:
> Hi
> Iv searched for this on the wolfram tutorials but could not find an answer to this.
> What I have to do is to convert a text file having a format like this:
> a b 123
> into a graph with a and b as the nodes and 123 as the weight..
> I thought of putting a and b in an array and 123 as the value and then creating a graph from it..the problem is Readlist would read each line as a separate record..and hence making an array out of it is seemingly difficult..
> What could be the solution??
> 


  • Prev by Date: Re: how to make arrays from text file in mathematica??
  • Next by Date: Mathematica Graphics - speed bottleneck
  • Previous by thread: Re: how to make arrays from text file in mathematica??
  • Next by thread: Selecting left hand sides from assignments