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

Home » Public Forums » archive » Re: Help on text data
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Help on text data [message #72288] Thu, 26 August 2010 00:29
d.poreh is currently offline  d.poreh
Messages: 406
Registered: October 2007
Senior Member
On Aug 25, 4:38 am, Gray <grayliketheco...@gmail.com> wrote:
> On Aug 25, 4:45 am, Dave Poreh <d.po...@gmail.com> wrote:
>
>
>
>
>
>> On Aug 24, 10:06 am, Gray <grayliketheco...@gmail.com> wrote:
>
>>> On Aug 24, 1:03 pm, Gray <grayliketheco...@gmail.com> wrote:
>
>>>> On Aug 24, 7:51 am, Dave Poreh <d.po...@gmail.com> wrote:
>
>>>> > Folks
>>>> > I am reading some text data (I don’t know how many) like this:
>>>> > pathName="d:\p\"
>>>> > List = findfile(pathName+"*.dat")
>>>> > nosFiles=N_ELEMENTS(List)
>>>> > data = ptrarr(nosFiles)
>>>> > for i = 0, nosFiles - 1 do begin
>>>> > x=read_ascii(list[i])
>>>> > data[i] = ptr_new(x)
>>>> > endfor
>>>> > I want to put this data in a string like this:
>>>> > names = ['data[0]', ' data[1]', ' data[2]',…] to proceed  David’s
>>>> > name_selctor.
>>>> > I do not know how to do that.
>>>> > Any help highly would be appreciated
>>>> > Cheers,
>>>> > Dave
>
>>>> I'm not sure exactly what you're asking... do you want a "names" array
>>>> where names[0] is the string 'data[0]'?  Or do you want a names array
>>>> where names[0] = data[0]?
>
>>> if the former:
>
>>> names = 'data['+strtrim(indgen(n_elements(data)),2)+']'
>
>> thanks Gary. this is exactly what i want and works perfect. What about
>> the posterior case: names[0] = data[0]?
>
>> Cheers,
>> Dave
>
> Well... you're using pointers.  If you want the actual "data" in
> data[0] to be stored as names[0] (presumably without being a pointer),
> then you would need to put data[0] as a single string variable.  If it
> is already (I don't know w/o looking at your data), then you're fine;
> otherwise, I guess you could do something like names[0] =
> strjoin(*data[0],'||') with the double pipe to indicate a line break
> or somesuch.

Thanks Gary.
Cheers,
Dave
Re: Help on text data [message #72293 is a reply to message #72288] Wed, 25 August 2010 04:38 Go to previous message
Gray is currently offline  Gray
Messages: 253
Registered: February 2010
Senior Member
On Aug 25, 4:45 am, Dave Poreh <d.po...@gmail.com> wrote:
> On Aug 24, 10:06 am, Gray <grayliketheco...@gmail.com> wrote:
>
>
>
>
>
>> On Aug 24, 1:03 pm, Gray <grayliketheco...@gmail.com> wrote:
>
>>> On Aug 24, 7:51 am, Dave Poreh <d.po...@gmail.com> wrote:
>
>>>> Folks
>>>> I am reading some text data (I don’t know how many) like this:
>>>> pathName="d:\p\"
>>>> List = findfile(pathName+"*.dat")
>>>> nosFiles=N_ELEMENTS(List)
>>>> data = ptrarr(nosFiles)
>>>> for i = 0, nosFiles - 1 do begin
>>>> x=read_ascii(list[i])
>>>> data[i] = ptr_new(x)
>>>> endfor
>>>> I want to put this data in a string like this:
>>>> names = ['data[0]', ' data[1]', ' data[2]',…] to proceed  David’s
>>>> name_selctor.
>>>> I do not know how to do that.
>>>> Any help highly would be appreciated
>>>> Cheers,
>>>> Dave
>
>>> I'm not sure exactly what you're asking... do you want a "names" array
>>> where names[0] is the string 'data[0]'?  Or do you want a names array
>>> where names[0] = data[0]?
>
>> if the former:
>
>> names = 'data['+strtrim(indgen(n_elements(data)),2)+']'
>
> thanks Gary. this is exactly what i want and works perfect. What about
> the posterior case: names[0] = data[0]?
>
> Cheers,
> Dave

Well... you're using pointers. If you want the actual "data" in
data[0] to be stored as names[0] (presumably without being a pointer),
then you would need to put data[0] as a single string variable. If it
is already (I don't know w/o looking at your data), then you're fine;
otherwise, I guess you could do something like names[0] =
strjoin(*data[0],'||') with the double pipe to indicate a line break
or somesuch.
Re: Help on text data [message #72296 is a reply to message #72293] Wed, 25 August 2010 01:45 Go to previous message
d.poreh is currently offline  d.poreh
Messages: 406
Registered: October 2007
Senior Member
On Aug 24, 10:06 am, Gray <grayliketheco...@gmail.com> wrote:
> On Aug 24, 1:03 pm, Gray <grayliketheco...@gmail.com> wrote:
>
>
>
>
>
>> On Aug 24, 7:51 am, Dave Poreh <d.po...@gmail.com> wrote:
>
>>> Folks
>>> I am reading some text data (I don’t know how many) like this:
>>> pathName="d:\p\"
>>> List = findfile(pathName+"*.dat")
>>> nosFiles=N_ELEMENTS(List)
>>> data = ptrarr(nosFiles)
>>> for i = 0, nosFiles - 1 do begin
>>> x=read_ascii(list[i])
>>> data[i] = ptr_new(x)
>>> endfor
>>> I want to put this data in a string like this:
>>> names = ['data[0]', ' data[1]', ' data[2]',…] to proceed  David’s
>>> name_selctor.
>>> I do not know how to do that.
>>> Any help highly would be appreciated
>>> Cheers,
>>> Dave
>
>> I'm not sure exactly what you're asking... do you want a "names" array
>> where names[0] is the string 'data[0]'?  Or do you want a names array
>> where names[0] = data[0]?
>
> if the former:
>
> names = 'data['+strtrim(indgen(n_elements(data)),2)+']'

thanks Gary. this is exactly what i want and works perfect. What about
the posterior case: names[0] = data[0]?

Cheers,
Dave
Re: Help on text data [message #72300 is a reply to message #72296] Tue, 24 August 2010 10:06 Go to previous message
Gray is currently offline  Gray
Messages: 253
Registered: February 2010
Senior Member
On Aug 24, 1:03 pm, Gray <grayliketheco...@gmail.com> wrote:
> On Aug 24, 7:51 am, Dave Poreh <d.po...@gmail.com> wrote:
>
>
>
>
>
>> Folks
>> I am reading some text data (I don’t know how many) like this:
>> pathName="d:\p\"
>> List = findfile(pathName+"*.dat")
>> nosFiles=N_ELEMENTS(List)
>> data = ptrarr(nosFiles)
>> for i = 0, nosFiles - 1 do begin
>> x=read_ascii(list[i])
>> data[i] = ptr_new(x)
>> endfor
>> I want to put this data in a string like this:
>> names = ['data[0]', ' data[1]', ' data[2]',…] to proceed  David’s
>> name_selctor.
>> I do not know how to do that.
>> Any help highly would be appreciated
>> Cheers,
>> Dave
>
> I'm not sure exactly what you're asking... do you want a "names" array
> where names[0] is the string 'data[0]'?  Or do you want a names array
> where names[0] = data[0]?

if the former:

names = 'data['+strtrim(indgen(n_elements(data)),2)+']'
Re: Help on text data [message #72301 is a reply to message #72300] Tue, 24 August 2010 10:03 Go to previous message
Gray is currently offline  Gray
Messages: 253
Registered: February 2010
Senior Member
On Aug 24, 7:51 am, Dave Poreh <d.po...@gmail.com> wrote:
> Folks
> I am reading some text data (I don’t know how many) like this:
> pathName="d:\p\"
> List = findfile(pathName+"*.dat")
> nosFiles=N_ELEMENTS(List)
> data = ptrarr(nosFiles)
> for i = 0, nosFiles - 1 do begin
> x=read_ascii(list[i])
> data[i] = ptr_new(x)
> endfor
> I want to put this data in a string like this:
> names = ['data[0]', ' data[1]', ' data[2]',…] to proceed  David’s
> name_selctor.
> I do not know how to do that.
> Any help highly would be appreciated
> Cheers,
> Dave

I'm not sure exactly what you're asking... do you want a "names" array
where names[0] is the string 'data[0]'? Or do you want a names array
where names[0] = data[0]?
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Fractal anakysis
Next Topic: Correlation between bands using IDL

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

Current Time: Wed Oct 08 15:52:25 PDT 2025

Total time taken to generate the page: 0.00762 seconds