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

Home » Public Forums » archive » function to convert string to array???
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: function to convert string to array??? [message #3903 is a reply to message #3843] Thu, 30 March 1995 00:00 Go to previous messageGo to previous message
zawodny is currently offline  zawodny
Messages: 121
Registered: August 1992
Senior Member
In article <3lek18$pm0@reznor.larc.nasa.gov> zawodny@arbd0.larc.nasa.gov (Joseph M Zawodny) writes:
> In article <1995Mar29.192708.17563@alw.nih.gov> cox <cox@colt.cpi.com> writes:
>
>> Here is my routine which converts a string of space or comma-delimited
>> items into a string array.

>
> Just do this:
>
> READS,input_string,numbers
>
> Where numbers is an array (intarr(10), or fltarr(12), or whatever)
> or a structure a={f1: 0, f2: 0.0, f3: bytarr(100), ... }
>


I was not sure about the use of a structure in the READS call,
but the following example illustrates my point more completely.

IDL> s='12, 24 36 3.456 2 3 4 5, 6,7'

; ^ there is a tab in this string here

IDL> a={f1:0, f2:0, f3:0L, f4:0., f5:intarr(6)}

IDL> help,/str,a
** Structure <4009be08>, 5 tags, length=24, refs=1:
F1 INT 0
F2 INT 0
F3 LONG 0
F4 FLOAT 0.00000
F5 INT Array(6)

IDL> reads,s,a

IDL> help,/str,a
** Structure <4009be08>, 5 tags, length=24, refs=1:
F1 INT 12
F2 INT 24
F3 LONG 36
F4 FLOAT 3.45600
F5 INT Array(6)
IDL> print,a.f5
2 3 4 5 6 7

Have fun,
--
Joseph M. Zawodny (KO4LW) NASA Langley Research Center
Internet: j.m.zawodny@larc.nasa.gov MS-475, Hampton VA, 23681-0001
TCP/IP: ko4lw@ko4lw.ampr.org Packet: ko4lw@n4hog.va.usa.na
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: [Q}:Rubberbanding in IDL
Next Topic: Default Color for IDL Widgets.

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

Current Time: Sun Oct 12 12:08:23 PDT 2025

Total time taken to generate the page: 1.85464 seconds