From: michuco on 2 Aug 2010 07:03 Hi, I am reading files of mixed strings and numbers using Data1= Import["file","Table"] where I have something like A" A" A' which should yield "{A",A",A'}", instead, mathematica gives me "{A" A",A'}". Is there anyway that I can disable the double quote " sign so that mathematica doesn't take this as a string? Many thanks Michuco
From: Albert Retey on 3 Aug 2010 06:34 Am 02.08.2010 13:03, schrieb michuco: > Hi, > > I am reading files of mixed strings and numbers using > > Data1= Import["file","Table"] > > where I have something like > > A" A" A' > > which should yield "{A",A",A'}", instead, mathematica > gives me "{A" A",A'}". Is there anyway that I can > disable the double quote " sign so that mathematica > doesn't take this as a string? > I think the "TextDelimiters" option is what you are looking for. Note that the list structure is still not what you expected: ImportString["A\" A\" A'", "Table", "TextDelimiters" -> {}] hth, albert
From: ibmichuco on 4 Aug 2010 05:51 On Aug 3, 5:34 am, Albert Retey <a...(a)gmx-topmail.de> wrote: > Am 02.08.2010 13:03, schrieb michuco: > > > Hi, > > > I am reading files of mixed strings and numbers using > > > Data1= Import["file","Table"] > > > where I have something like > > > A" A" A' > > > which should yield "{A",A",A'}", instead, mathematica > > gives me "{A" A",A'}". Is there anyway that I can > > disable the double quote " sign so that mathematica > > doesn't take this as a string? > > I think the "TextDelimiters" option is what you are looking for. > Note that the list structure is still not what you expected: > > ImportString["A\" A\" A'", "Table", "TextDelimiters" -> {}] > > hth, > > albert Hi, That's it. Thanks Michuco
From: David Bailey on 6 Aug 2010 06:55 On 04/08/10 10:51, ibmichuco wrote: > On Aug 3, 5:34 am, Albert Retey<a...(a)gmx-topmail.de> wrote: >> Am 02.08.2010 13:03, schrieb michuco: >> >>> Hi, >> >>> I am reading files of mixed strings and numbers using >> >>> Data1= Import["file","Table"] >> >>> where I have something like >> >>> A" A" A' >> >>> which should yield "{A",A",A'}", instead, mathematica >>> gives me "{A" A",A'}". Is there anyway that I can >>> disable the double quote " sign so that mathematica >>> doesn't take this as a string? >> >> I think the "TextDelimiters" option is what you are looking for. >> Note that the list structure is still not what you expected: >> >> ImportString["A\" A\" A'", "Table", "TextDelimiters" -> {}] >> >> hth, >> >> albert > > Hi, > > That's it. Thanks > > Michuco > A more general solution is to read the file with something like: ReadList["c:\\mydir\\myfile.dat", String] This gives you a list of strings - one for each line of the file - and you can process them as you like. David Bailey http://www.dbaileyconsultancy.co.uk
|
Pages: 1 Prev: Bare Bones Backup Button Next: Surprising FullSimplify result |