help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to calculate mean for many files


From: Sergei Steshenko
Subject: Re: how to calculate mean for many files
Date: Mon, 14 Dec 2009 03:55:54 -0800 (PST)


--- On Sun, 12/13/09, febty febriani <address@hidden> wrote:

> From: febty febriani <address@hidden>
> Subject: Re: how to calculate mean for many files
> To: address@hidden
> Date: Sunday, December 13, 2009, 9:55 PM
> For Jaroslav, I am sorry so much. I want to
> send my email to octave forum, not your email. 
> 
> For everyone, below my problem.
> I grabbed from my previous email.
> 
> ###
> I am trying to describe my problem clearer. I am sorry
> there is some misunderstanding with my description.
> 
> I
> have many files of data (total of files is about 365
> files). Every file
> has 9 columns and 36 rows. How to find the mean of every
> row and column
> from files? For example :
> 
> 
> the first file
> 
> 1   1   2   3 ...  6
> 2  2   1    4 ... 5
> .
> .
> .
> 3   4  2    1 .... 2
> 
> the second file
> 
> 
> 
> 2  1   5   3 ...  2
> 
> 2  1   1   2 ...  1
> 
> .
> 
> .
> 
> .
> 
> 4   1  1    2 .... 1
> 
> 
> for above sample matrix, I will get mean for every row and
> column is
> 
> 1.5   1   3.5   3  ...     4 
> 2    1.5   1    3  ...     3
> .
> .
> .
> 3.5  2.5  1.5  1.5 ... 1.5
> 
> 
> ####
> 
> any kind of help is appreciated. 
> Thanks very much for your kind responses.
> 
> Regards,
> febty
> 
> 
> 2009/12/14 febty febriani <address@hidden>
> 
> Hi everyone
> 
> I am trying to describe my problem clearer. I am sorry
> there is some misunderstanding with my description.
> 
> I have many files of data (total of files is about 365
> files). Every file has 9 columns and 36 rows. How to find
> the mean of every row and column from files? For example :
> 
> 
> the first file
> 
> 1   1   2   3 ...  6
> 2  2   1    4 ... 5
> .
> .
> .
> 3   4  2    1 .... 2
> 
> the second file
> 
> 
> 
> 2  1   5   3 ...  2
> 
> 2  1   1   2 ...  1
> 
> .
> 
> .
> 
> .
> 
> 4   1  1    2 .... 1
> 
> 
> for above sample matrix, I will get mean for every row and
> column is
> 
> 1.5   1   3.5   3  ...     4 
> 2    1.5   1    3  ...     3
> .
> .
> .
> 3.5  2.5  1.5  1.5 ... 1.5
> 
> 
> 
> 
> any kind of help is appreciated. 
> Thanks very much for your kind responses.
> 
> febty
> 
> -- 
> 
> ******
> febty febriani
> Indonesian Institute of Sciences
> Research Center for Physics
> 
> 
> Kompleks PUSPIPTEK
> Serpong, Indonesia, 15314
> 
> 
> 
> 
> -- 
> 
> ******
> febty febriani
> Indonesian Institute of Sciences
> Research Center for Physics
> Kompleks PUSPIPTEK
> Serpong, Indonesia, 15314
> 
> 


It is easy to calculate mean in/for a matrix, so you need to load each next
file into a matrix and then add that matrix with initially zeroed one - 
the latter one is called accumulator

Then you'll divide what is necessary in the accumulator by N, where N is
number of your files.

I.e. you need to know how to load a file into a matrix - I think there is
'load' operator in 'octave', look it up.

Regards,
  Sergei.


      



reply via email to

[Prev in Thread] Current Thread [Next in Thread]