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: febty febriani
Subject: Re: how to calculate mean for many files
Date: Mon, 14 Dec 2009 18:05:07 +0900

thank you for your quick response.
I tried to do what your advice is. I replaced this: "filenames = # cell array of strings" with the folder name where I put data. But, I met error : parse error: syntax error.
Are there still problems?

regards,
febty


2009/12/14 Jaroslav Hajek <address@hidden>
On Mon, Dec 14, 2009 at 6:55 AM, febty febriani <address@hidden> wrote:
> 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
>


filenames = # cell array of strings
matrices = cellfun (@load, filenames, "UniformOutput", false);
means = plus (matrices{:}) / numel (matrices);

can you beat it... :)

regards

--
RNDr. Jaroslav Hajek
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz



--

******
febty febriani
Indonesian Institute of Sciences
Research Center for Physics
Kompleks PUSPIPTEK
Serpong, Indonesia, 15314

reply via email to

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