RE: How to import multiple data for tables
- To: mathgroup at smc.vnet.net
- Subject: [mg35974] RE: [mg35967] How to import multiple data for tables
- From: "DrBob" <majort at cox-internet.com>
- Date: Sun, 11 Aug 2002 05:13:32 -0400 (EDT)
- Reply-to: <drbob at bigfoot.com>
- Sender: owner-wri-mathgroup at wolfram.com
You're getting the error because you're trying to set StringDrop (of an
argument) equal to something. The name of a variable is a Symbol, not a
string, so you need to change the result of StringDrop into a Symbol,
and then set that symbol equal to the result of Import.
If you don't want the files deleted, for heaven's sake take DeleteFile
out of the command!
Scan[(name = Symbol@StringDrop[#, -4];
Evaluate@name =.; Evaluate[name] = Import[#, "Text"]) &,
FileNameList]
(I was testing using Text files.)
Bobby Treat
-----Original Message-----
From: Bettina [mailto:bho at em.uni-karlsruhe.de]
To: mathgroup at smc.vnet.net
Subject: [mg35974] [mg35967] How to import multiple data for tables
Hi
I have a lot of different files, containing data (already formatted for
mathematica) which is supposed to be imported as tables with names
derived from the original file name. Problem being:
Scan[(StringDrop[#,-4]=Import[#];DeleteFile[#])&,FileNameList] only
gives "StringDrop protected....". What I also do not like about the
above command is, that the data files are deleted. How can I get what I
would like to have?
Thanks for the help.
Bettina