Services & Resources / Wolfram Forums / MathGroup Archive

MathGroup Archive 2007

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

Search the Archive

Re: Importing and manipulating text files

  • To: mathgroup at
  • Subject: [mg83506] Re: Importing and manipulating text files
  • From: Szabolcs Horvát <szhorvat at>
  • Date: Wed, 21 Nov 2007 05:58:43 -0500 (EST)
  • References: <fi0peu$6cl$>

jpalko at wrote:
> I have a a large text file saved in notepad that i would like to
> import into Mathematica and break up by columns.  I am able to import
> the file but I have no idea how to break up the data.  The data is
> seperated by commas.  In Mathematica the data comes in as a table with
> 5 places {1,2,3,4,5}. There are about 2500 data sets of this.  I would
> like to take the specific place value from each data set ({1,2,3,4,5})
> and make a column of data mathematica can use.  For example, I would
> like to take the the second value from all 2500 data sets and turn it
> into a seperate list of data. I am not sure if this is possible.  Does
> anyone have any experience with this?  Thanks.

Of course it it possible.  Here are a few examples:

In[1]:= data = {{a, b, c}, {1, 2, 3}, {x, y, z}, {9, 8, 7}}
Out[1]= {{a, b, c}, {1, 2, 3}, {x, y, z}, {9, 8, 7}}

In[2]:= data[[3]]
Out[2]= {x, y, z}

In[3]:= data[[3, 1]]
Out[3]= x

In[4]:= data[[All, 1]]
Out[4]= {a, 1, x, 9}

In[5]:= Transpose[data]
Out[5]= {{a, 1, x, 9}, {b, 2, y, 8}, {c, 3, z, 7}}

In[6]:= Transpose[data][[1]]
Out[6]= {a, 1, x, 9}


  • Prev by Date: Re: StringInput Question
  • Next by Date: Re: Copy and Pasting Tables into Spreadsheet
  • Previous by thread: Importing and manipulating text files
  • Next by thread: Bug with LaplaceTransform?