Re: Reading * symbol out of a string [message #66415] |
Mon, 11 May 2009 12:46 |
fugu
Messages: 5 Registered: February 2009
|
Junior Member |
|
|
On May 11, 6:53 pm, "Kenneth P. Bowman" <k-bow...@null.edu> wrote:
> In article
> < 91048f09-343c-4ffb-9e4f-b9caf8062...@r3g2000vbp.googlegroups .com >,
>
>
>
> fugu <daniel.hawel...@gmail.com> wrote:
>>> Did you do
>
>>> x = ''
>
>>> to ensure that it was a string before trying to read into it?
>
>> Yes, it is a string. I also check this during runtime (X STRING
>> = '*280 948 80 0')
>> is the output from help, x. The numbers do get read properly as well.
>
>> Thanks,
>
>> Daniel
>
> Sorry, my mistake.
>
> I meant
>
> stage = ''
>
> The default variable type for an undefined variable in a READ
> statement is FLOAT.
>
> Ken Bowman
yes, that's the one. Thanks a lot!
Daniel
|
|
|
|
Re: Reading * symbol out of a string [message #66418 is a reply to message #66416] |
Mon, 11 May 2009 09:43  |
fugu
Messages: 5 Registered: February 2009
|
Junior Member |
|
|
> Did you do
>
> x = ''
>
> to ensure that it was a string before trying to read into it?
Yes, it is a string. I also check this during runtime (X STRING
= '*280 948 80 0')
is the output from help, x. The numbers do get read properly as well.
Thanks,
Daniel
|
|
|
Re: Reading * symbol out of a string [message #66419 is a reply to message #66418] |
Mon, 11 May 2009 09:17  |
Kenneth P. Bowman
Messages: 585 Registered: May 2000
|
Senior Member |
|
|
In article
<39c8864a-a3f9-4022-8841-82ba2fb23aa2@z5g2000vba.googlegroups.com>,
fugu <daniel.hawellek@gmail.com> wrote:
> Dear all,
>
> I have a string x
>
> X STRING = '*280 948 80 0'
>
> which I am trying to read into variables:
>
> READS, x, stage, lat, lon, wind, press, format =
> '(A1,I3,1x,I3,1x,I3,1x,I4)'
>
> This returns % Type conversion error: Unable to convert given STRING
> to Float.
>
> and the problem seems to be the (ASCII decimal 42 mapped -) * symbol.
>
> I have tried to read it into various formats (replace A by I or F for
> instance), but none works.
>
> Has anyone got an idea, why that is and how to work around it?
>
> Many thanks!
>
> Daniel
Did you do
x = ''
to ensure that it was a string before trying to read into it?
Ken Bowman
|
|
|