Re: file I/O and arithmetic calculation [message #84489] |
Thu, 23 May 2013 06:38  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Keira Wilson writes:
> Thank you for your response.
> This is for one file.
> How can I simulate it for five files?
Don't know. Maybe do it five times? Put it in a loop? Use variables?
These are pretty basic programming concepts. What are you doing to learn
how to program? What books have you read?
I highly recommend you get ahold of Ken Bowman's book An Introduction to
Programming with IDL.
We are generally happy to help answer questions here, but we need some
evidence of some work on your part. Otherwise, it appears you are just
asking people to do your work for you. Show us some code that doesn't
work, give us an idea why you think it doesn't work, formulate a
specific question, and we will see if we can help sort it out for you.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
|
|
|
Re: file I/O and arithmetic calculation [message #84490 is a reply to message #84489] |
Thu, 23 May 2013 04:59   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Keira Wilson writes:
> I would be grateful if someone could guide me:
> I have five text files each of 7 columns by 9 rows
> file_one = 'C:\one.txt'
> file_two = 'C:\two.txt'
> . . .
> file_five = 'C:\five.txt'
>
> How can I calculate the mean of first row for each file, if mean of first column of each file is 50?
> I would appreciate a very simple code to be learn.
What do you imagine the mean of the first column of data has to do with
the mean of the first row of the data? This is kind of like learning
your dentist has three children.
Anyway, something like this would work:
Openr, lun, file_one, /Get_lun
row = Fltarr(7)
ReadF, lun, row
meanRow1 = Mean(row)
Free_Lun, lun
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
|
|
|
|
|