MathGroup Archive 2011

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

Search the Archive

Re: Please add me to this group

  • To: mathgroup at smc.vnet.net
  • Subject: [mg117092] Re: Please add me to this group
  • From: Bill Rowe <readnews at sbcglobal.net>
  • Date: Wed, 9 Mar 2011 07:01:50 -0500 (EST)

On 3/8/11 at 5:32 AM, hortonl at bellsouth.net (Len Horton) wrote:

>As a new user of Mathematica and as a purchaser of the Home Edition,
>which does not include any support, I am trying to figure out how to
>take data from an Excel spreadsheet into Mathematica to analyze and
>graph.

>I have taken a couple of free seminars on line, but I have not been
>able to figure out how to do just a few basic statistical
>things. Each column in my spreadsheet is a variable.  In order
>to produce a
>histogram of one of those variables, I had to open the spreadsheet
>in Excel, copy the column, then paste it into the curly braces
>inside the Histogram function, then eliminate the carriage returns
>manually while inserting commas manually in order to produce the
>Histogram.  Surely there must be a faster way.

>In the first place, I cannot tell where to place the Excel file so
>that Mathematica knows where it is.  Anything you could do to get me
>started would be much appreciated.

Since Mathematica can read Excel files, there is absolutely no
need to paste one column at a time.

The simplest way I can think of to get you started is to have
you put the Excel file in the directory returned when you execute

Directory[]

in an empty cell. That will be the current working directory for
Mathematica. If the file is in the current working directory you
can read the data from the Excel file into Mathematica using Import.

That is

data = Import[filename.ext,"XLS"][[1]];

will read the data contained in the first worksheet of the Excel
Workbook filename.ext.

Then you can make a histogram of say column 3 of the file by doing

Histogram[data[[All,3]]]

Note, although you may find it simpler at first to simply put
the Excel file into the current working directory Mathematica
has the ability to work with the Excel file located wherever it
happens to be on your hard drive. You can either use
SetDirectory to set the current working directory to the
directory containing the file or you can use the menu command
Insert->File Path... to browse to the directory containing the
Excel file and have Mathematica insert the full file path to
that file in the front end notebook at your cursor position.



  • Prev by Date: Re: Any recommendations for new hardware (quadcore/GPUs)?
  • Next by Date: Algebraic substitution with PolynomialReduce
  • Previous by thread: Re: Please add me to this group
  • Next by thread: Re: Please add me to this group