Re: Export, Import, Convert Types Again?

*To*: mathgroup at smc.vnet.net*Subject*: [mg57214] Re: [mg57193] Export, Import, Convert Types Again?*From*: Clifford Martin <camartin at snet.net>*Date*: Sat, 21 May 2005 02:39:27 -0400 (EDT)*Sender*: owner-wri-mathgroup at wolfram.com

Lee, I do something similar. I import data from Excel into Mathematica then create my functions, etc. inside Mathematica. Then I save the whole session using DumpSave. This maintains my data, my functions, etc. If I want to view stuff with outside programs I Export similarly to what you did but don't try to reimport that data. I continue to use my DumpSave file. Works fairly well. Cliff --- Lee Newman <leenewm at umich.edu> wrote: > 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 > > > > >