How can I use: DateString/datevac for a long year dataset? Dates from 01/01/1988 to 05/03/2005?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Ice lady
el 29 de Jul. de 2016
How can I use: DateString = '01/01/1988'; formatIn = 'dd/mm/yyyy'; datevec(DateString,formatIn)
to convert a long data column Date = G(:,1); Dates are in dd/mm/yyyy: from 01/01/1988 to 05/03/2005 and I need to change them to yyyy mm dd to have them the same as other data I am using in a script?
It currently converts only 01/01/1988, to:
ans =
1988 1 1 0 0 0
I tried:
DateString = '01/01/1988:05/03/2005'; formatIn = 'dd/mm/yyyy'; datevec(DateString,formatIn)
But it still only did 01/01/1988
Data matrix is as follows: Full Date = G(:,1); Year = G(:,2); Temp data = G(:,3);
Then I just want to output new date to be: year (column 1), month(column 2), day(column 3) and temperature data (column 4)
Any help appreciated.
2 comentarios
Respuesta aceptada
Andrei Bobrov
el 29 de Jul. de 2016
Editada: Andrei Bobrov
el 29 de Jul. de 2016
bed variant (Now I do not have access to MATLAB and use the Octave):
f = fopen('FB_DSAT_1988to2005with year_USE.txt');
c = textscan(f,'%s','delimiter','\n');
fclose(f);
c = c{:}(~cellfun(@isempty,c{:}));
z = regexp(c,'(\-)?\d*(\.)?','match');
zz = cell2mat(cellfun(@(x)str2double([x(3:-1:1) [x{5:end}]]),z,'un',0));
mean daily:
[dly,~,ii] = unique(zz(:,1:3),'rows');
out = [dly, accumarray(ii,zz(:,end),[],@mean)];
4 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Dates and Time 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!