Re: Reading data.
- To: mathgroup at smc.vnet.net
- Subject: [mg21222] Re: Reading data.
- From: "Allan Hayes" <hay at haystack.demon.co.uk>
- Date: Mon, 20 Dec 1999 02:27:43 -0500 (EST)
- References: <831v6a$g49@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
"Madhusudan Singh" <chhabra at eecs.umich.edu> wrote in message news:831v6a$g49 at smc.vnet.net... > I have a data file with 7 columns and 100 rows. How do I import data from > that into 7 different arrays in Mathematica ? ------snip ------- Madhusudan , The following uses Export and Import from Mathematica 4.0 Make table data = Table[Random[Integer, {0, 9}], {5}, {3}] {{8, 9, 3}, {6, 2, 0}, {8, 3, 5}, {0, 6, 6}, {3, 8, 3}} Export it to the file "temp" Export["temp", data, "Table" ]; This is what is in the file !! "temp" 8 9 3 6 2 0 8 3 5 0 6 6 3 8 3 Import the file Import["temp", "Table" ] {{8, 9, 3}, {6, 2, 0}, {8, 3, 5}, {0, 6, 6}, {3, 8, 3}} With Mathematica 3.0 we can use ReadList["temp", Number, RecordLists -> True ] {{8, 9, 3}, {6, 2, 0}, {8, 3, 5}, {0, 6, 6}, {3, 8, 3}} -- Allan --------------------- Allan Hayes Mathematica Training and Consulting Leicester UK www.haystack.demon.co.uk hay at haystack.demon.co.uk Voice: +44 (0)116 271 4198 Fax: +44 (0)870 164 0565