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

Home » Public Forums » archive » Reading formatted input with READS
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: Reading formatted input with READS [message #93602 is a reply to message #93598] Thu, 01 September 2016 07:15 Go to previous messageGo to previous message
Markus Schmassmann is currently offline  Markus Schmassmann
Messages: 129
Registered: April 2016
Senior Member
On 09/01/2016 10:55 AM, Markus Schmassmann wrote:
> On 09/01/2016 05:27 AM, Stefano Garcia wrote:
>> This is my first post so please let me know if I posted it in the
>> wrong place.
>>
>> My problem is purely that I am not yet familiarized with the IDL
>> formats. I would like to use READS to read what is in between the
>> square brackets below:
>>
>> %M.z 20.37 [~] D 2011A&A...527A..78F
>> %M.z 20.37 [0.12] D 2011A&A...527A..78F
>>
>> So, there is two cases, one when it is a STRING and the other, when
>> it is a FLOAT.
>>
>> Is there a way to read that?
> one way to read the string is the following:
>
> str=strMid(string,strPos(string,'[')+1,strPos(string,']')-st rPos(string,'[')-1)
>
> fltRegEx='^[-+]?(([0-9]*\.?[0-9]+([ed][-+]?[0-9]+)?)|(inf)|( nan))$'
> isFloat=stRegEx(str,fltRegEx,/boolean,/fold_case)
> if isFloat then out=float(str) else out=str
>
> if you want to do it with READS, you should first figure out which terms
> in your table have a fixed with, this will simplify considerably coming
> up with a correct format code. For details on these, see:
>
> http://www.harrisgeospatial.com/docs/format_codes.html
made an error with the regex, hope this one is correct now:

fltRegEx='^[-+]?(((([0-9]*\.?[0-9]+)|([0-9]+\.))([ed]([-+]?[ 0-9]+)?)?)|(inf)|(nan))$'
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Band Math
Next Topic: contrast enhancement

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

Current Time: Wed Oct 08 17:54:58 PDT 2025

Total time taken to generate the page: 0.00416 seconds