Effacer les filtres
Effacer les filtres

A problem with the date structure

1 vue (au cours des 30 derniers jours)
salva
salva le 29 Juil 2012
Dear all,
I load some data from an excel file and I obtain D={
'dates'
[40521]
[40461]
[40370]
[40310]
[40575]
'30/01/11'
'27/02/11'
'27/03/11'
'24/04/11'
'22/05/11'
'19/06/11'
'17/07/11'
'14/08/11'
[40856]
[40796]
[40705]
};
I know that is has to do with the setting of excel and that I should format the dates.
Can I correct this problem within Matlab so as to have only this format '17/07/11' and not date numbers?
thanks

Réponse acceptée

Walter Roberson
Walter Roberson le 29 Juil 2012
idx_to_change = cellfun(@isnumeric, D);
dateshift = 695422; %1904 date system; 693960 for 1900 date system
D(idx_to_change) = cellstr( datestr( [D{idx_to_change}] + dateshift ) );
  4 commentaires
Walter Roberson
Walter Roberson le 29 Juil 2012
newdates = cellstr( datestr( [D{idx_to_change}] + dateshift, 'mm/dd/yy' ) );
salva
salva le 29 Juil 2012
thank you:)

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Dates and Time dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by