From: michuco on
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
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
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
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