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

Home » Public Forums » archive » Re: add a line and column into an 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: add a line and column into an array [message #64039 is a reply to message #64038] Mon, 01 December 2008 18:56 Go to previous message
Chris[6] is currently offline  Chris[6]
Messages: 84
Registered: July 2008
Member
On Dec 1, 3:50 pm, Elkunn <Wasit.Weat...@gmail.com> wrote:
> Hello,
> I have an array of floating numbers. Can I add one line as the first
> line of the array, and one column as the first column,
> The data I would like to add is strings. Basically, I want to print
> them into a txt file
> E.G.:
> data= fltarr(9,9)
> years = ['1950', '1960', '1970', '1980', '1990', '2000', '2010',
> '2020', '2030']
> Name= ['test1', 'test2', 'test3', 'test4', 'test5', 'test6', 'test7',
> 'test8', 'test9']
>
> I want to print years as a 1st line of the txt file, and Name as the
> 1st column, then the data array.
>
> Thanks

try something like this (untested)

openw, 1, 'out.txt'
printf, 1, years ;- you may need to transpose this to get it to print
in one line
for i = 0, 8, 1 do begin
printf, 1, name[i], data[i,*], format='(a, f)' ;- maybe you want data
[*,i]
endfor
close, 1

chris
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: IDL app development with "Collections Framework"
Next Topic: help with "interpolate"

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

Current Time: Fri Oct 10 20:13:32 PDT 2025

Total time taken to generate the page: 7.04237 seconds