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

Home » Public Forums » archive » READ ARRAY and extract the values
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: READ ARRAY and extract the values [message #93131 is a reply to message #93129] Sat, 30 April 2016 23:59 Go to previous messageGo to previous message
Sapna Mishra is currently offline  Sapna Mishra
Messages: 66
Registered: December 2015
Member
On Saturday, April 30, 2016 at 3:19:59 AM UTC+5:30, Tanvir Hussain wrote:
> Hi All
>
> I have a data which is organized in the following way
>
> obj1 12.5
> obj1 14.5
> obj1 15.4
> obj1 14.0
> obj1 12.5
> obj1 14.5
> obj1 15.4
> obj1 14.0
> obj1 12.5
> obj1 14.5
> obj1 15.4
> obj1 14.0
> obj2 12.5
> obj2 14.5
> obj2 15.4
> obj2 14.0
> obj2 12.5
> obj2 14.5
> obj2 15.4
> obj2 14.0
> obj2 12.5
> obj2 14.5
> obj2 15.4
> obj2 14.0
>
> I want to extract all the values associated with obj1 and write them in a separate array. In a similar way for the obj2. Please help.
>
> Thanks
> Tanvir

readcol,"data.dat",obj,value

for i=0; n_elements(obj)-1 do begin
if obj(i)='obj1' then
forprint,obj(i),value(i),text='obj1.dat',F='(A,1x,F)'
else
forprint,obj(i),value(i),text='obj2.dat',F='(A,1x,F)'

endfor

Then you can store the value of files obj1.dat and obj2.dat in different array using readcol or openwr.
This may be the easiest way, else there might be so many other ways which others can help....

Thanks
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Is there a way to tell if program is running within the IDLDE?
Next Topic: READ array from a file

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

Current Time: Wed Oct 08 19:27:15 PDT 2025

Total time taken to generate the page: 0.00476 seconds