Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

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

Search the Archive

Export, Import, Convert Types Again?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg57193] Export, Import, Convert Types Again?
  • From: Lee Newman <leenewm at umich.edu>
  • Date: Fri, 20 May 2005 04:43:32 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Q: What is the (best) way to save a big expression of data to be used 
later in the same notebook without having to do type conversion processing?

Situation:

1) I have a notebook that imports data from various Excel spreadsheets 
and converts the data to the desired types.  When complete, I "save" the 
expression containing the data using Export, i.e, 
Export["featureDB.tsv", "TSV"].  I do this so I don't have to re-process 
the data everytime I do analysis on it in this notebook.

2) When I open the noteobook again, I import the data using the 
statement:  featureDB = Import["featureDB.tsv"]

Problem:
Many of type conversions that I took the time to process are lost. 
Using Head /@ featureDB[[1]]  before and after the export/re-import, the 
types are as follows:

Before:  {Integer, Integer, List, List, List, Integer, List, List, 
Symbol, List}
After   : {Integer, Integer, String, String, String, Integer, String, 
String, String, String}

So it seems that lists become Strings as  Symbols (e.g. True, False, 
Null).  I use Export so I can view the data outside Mathematica using a text 
editor -- should I use Save instead?  Is there another Export format 
that will preserve mathematica expressions like lists upon Import?

Thanks,
Lee





  • Prev by Date: Re: Re: Visualization
  • Next by Date: Merging InterpolationFunctions
  • Previous by thread: Re: GridLines issue
  • Next by thread: Re: Export, Import, Convert Types Again?