Borrar filtros
Borrar filtros

how to arrange multiple xlsx files in year to seasonal

1 visualización (últimos 30 días)
skyhunt
skyhunt el 28 de Dic. de 2014
Comentada: skyhunt el 2 de En. de 2015
Hi.. I have 47 xlsx files and i want arrange year to seasonal. i attached my input and output xlsx files here. From this i want to plot 47 xlsx file's Nov mean (month) vs Year (1971-72 to 2000-01); like wise all months (Dec,Jan,Feb,Mar,Apr) please help me..i waiting for your helpful replying Thank you....
  2 comentarios
Geoff Hayes
Geoff Hayes el 28 de Dic. de 2014
Please clarify how the 47 Excel files fit into your question. What does each file represent? i.e. is this the data from a particular city for 12 months of the year from 1971-2001, or is it something else?
skyhunt
skyhunt el 29 de Dic. de 2014
Editada: skyhunt el 29 de Dic. de 2014
I have 47 stations precipitation data and the data format in Excel files. Each Data file represents 12 months (Jan-Dec) from 1971 to 2001.I want to calculate seasonal mean from Nov-Apr(Nov,Dec,Jan,Feb,Mar,Apr); I want to arrange like this 1971-72 (Nov,Dec,Jan,Feb,Mar,Apr) 1972-73 (Nov,Dec,Jan,Feb,Mar,Apr) etc...

Iniciar sesión para comentar.

Respuesta aceptada

Andrei Bobrov
Andrei Bobrov el 29 de Dic. de 2014
Editada: Andrei Bobrov el 29 de Dic. de 2014
[n,tt] = xlsread('input.xlsx');
m = size(n,1);
[ii,~] = ndgrid(1:12,zeros(m,1));
j1 = find(ii == 11,1,'first');
j2 = find(ii == 4,1,'last');
n1 = n(:,2:end)';
n2 = n1(j1:j2);
out1 = reshape(n2((rem(0:numel(n2)-1,12)+1) <= 6),6,[])';
out = [n(1:m-1,1), n(2:m,1), out1];
OR just
[n,tt] = xlsread('input.xlsx');
out = [n(1:end-1,1), n(2:end,1), n(1:end-1,11:12), n(2:end,2:5)];
  3 comentarios
Andrei Bobrov
Andrei Bobrov el 29 de Dic. de 2014
Let name your xlsx files is as 'nameyourfileinput1.xlsx', 'nameyourfileinput2.xlsx' and etc.
t1 = dir('nameyourfileinput*.xlsx');
nn = {t1.name};
mth = cellstr(datestr(datenum(2014,1:12,1),'mmm'));
nexl = [{'year1','year2'},mth([11,12,1:4])'];
for jj = 1:numel(t1)
n = xlsread(nn{jj});
nout = [n(1:end-1,1), n(2:end,1), n(1:end-1,11:12), n(2:end,2:5)];
xlswrite(sprintf('nameyourfileoutput%02d.xlsx',jj),...
[nexl;num2cell(nout)],1,sprintf('A1:H%d',size(nout,1)));
end
skyhunt
skyhunt el 2 de En. de 2015
thank you very much....

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Data Import from MATLAB en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by