comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: string conversion & integer
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: string conversion & integer [message #56644 is a reply to message #56636] Thu, 08 November 2007 09:37 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
metachronist writes:

> Okay folks, I am sure this has been discussed many times already.
> Maybe trivial/silly... Anyway, to make sure:
>
> Problem:
> ------------
>> print,where(X.dd eq dd_d)
> -1
> I think it's got to do with internal representation:
>
> dd_d is originally read in as "string", for ease of concatenation and
> constructing filename, along with year and month etc. Say, for
> example, as '07'
>
> But field "dd" in X.dd is defined in the format statement as:
> dd:0L , say for example, from 1 to 10.
> So there is a type mismatch. I tried:
>
>> print, where(X.dd eq fix(dd_d,type=3)
> -1
>> print, where(X.dd eq long(dd_d))
> -1
>
> No luck. Is there a way out "other than defining dd_d as long
> originally and make excessive use of string/strtrim/strmid etc while
> constructing filenames?

Well, here is an experiment:

IDL> x = {dd:indgen(10)}
IDL> y = '8'
IDL> print, where(x.dd eq fix(y))
8

I think maybe you are making assumptions that just
ain't true in your code. :-)

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: MAP keyword
Next Topic: Re: MAP keyword

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 16:25:20 PDT 2025

Total time taken to generate the page: 1.36126 seconds