convert to monthly mean (arrange data)

7 ビュー (過去 30 日間)
skyhunt
skyhunt 2014 年 9 月 22 日
コメント済み: skyhunt 2014 年 9 月 27 日
I attached here 2 text files ..one is input file(complete data of year,month number,Day1 to day31) and second one is output file(year, month wise mean).I want this output format only.
  6 件のコメント
skyhunt
skyhunt 2014 年 9 月 24 日
編集済み: skyhunt 2014 年 9 月 24 日
I am very new to this matlab. Still i am not getting my format..please anybody help for this script..save my life
Geoff Hayes
Geoff Hayes 2014 年 9 月 24 日
What happened when you loaded the data from file using importdata? Please post some or all of the code that you have written to accomplish this task.

サインインしてコメントする。

採用された回答

Andrei Bobrov
Andrei Bobrov 2014 年 9 月 25 日
編集済み: Andrei Bobrov 2014 年 9 月 25 日
f=fopen('input.txt');
c = textscan(f,repmat('%f ',1,33),...
'EmptyValue',nan,'HeaderLines',1,'CollectOutput',1);
fclose(f);
c1 = c{1};
val = nanmean(c1(:,3:end),2);
[yrs,~,ii] = unique(c1(:,1));
mmm = cellstr(datestr(datenum(2014,(1:12)',1),'mmm'))';
output = [[{'year'},mmm];
[num2cell(yrs), accumarray([ii, c1(:,2)],val,[],@(x){x})]];
  4 件のコメント
skyhunt
skyhunt 2014 年 9 月 26 日
I changed tilde with N, now it is working...how to write loop for this about 100 xlsx sheets?..
skyhunt
skyhunt 2014 年 9 月 27 日
I created batch file as 'files.dat', with in that 100 .dat files are there ,and I want create for loop for this above script,please help me..?

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDates and Time についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by