Re: reading from file
- To: mathgroup at smc.vnet.net
- Subject: [mg80197] Re: reading from file
- From: Bill Rowe <readnewsciv at sbcglobal.net>
- Date: Tue, 14 Aug 2007 07:15:20 -0400 (EDT)
On 8/13/07 at 4:27 AM, jsheinwald at comcast.net (Jesse Sheinwald)
wrote:
>This is an example of reading from a file that I took from the book
>"An Introduction to Programming with Mathematica" by Wellin. The
>author provides data for a number of examples and the reader is
>instructed to store this date either in the BaseDirectory or the
>UserBaseDirectory.
Did you do this? That is did you create the indicated directory
and copy the file to it?
If you didn't then doing
>I entered the Mathematica code (v6) as this with
>the programs response...
>datafile = ToFileName[{$BaseDirectory, "Applications", "IPM3",
>"DataFiles"}, "dataset.m"]
>Out[4]=
>C:\Documents and Settings\All Users\Application
>Data\Mathematica\Applications\ \IPM3\DataFiles\dataset.m
>data = Import[datafile, "Table"]
>$Failed
will result in an error since the file and directory won't
exist. ToFileName constructs a valid path regardless of whether
the file and directory exist or not.
--
To reply via email subtract one hundred and four