Matlab - Convertir fechas a números a partir del 1900

 
Vista:

Convertir fechas a números a partir del 1900

Publicado por Frixhias (1 intervención) el 31/03/2008 22:30:42
Hola, necesito hacer unas figuras en matlab y para eso necesito tener las fechas como valores númericos, según me explicaron una vez (pero no recuerdo bien), se hacía tomando la fecha 01/01/1900 y se le restaba la fecha del muestreo?? luego se transformaba a formato número la celda.

Saben como es exactamente este procedimiento y que significa com tal?, me parece que es el día expresado en un número a partir del día 1 del año en que se encuentra, es decir si es el 10 de enero del 2008, sería el día 10 a secas. Pero no estoy seguro.

Gracias.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:Convertir fechas a números a partir del 1900

Publicado por fismat (391 intervenciones) el 01/04/2008 02:59:36
Hola

te envio la ayuda de matlab refernte a fechas

>> help datenum
DATENUM Serial date number.
N = DATENUM(S) converts the string or date vector (as defined by
DATEVEC) S into a serial date number. Date numbers are serial days
where 1 corresponds to 1-Jan-0000. If S is a string, it must be in
one of the date formats 0,1,2,6,13,14,15,16,23 as defined by
DATESTR.
Certain formats may not contain enough information to compute a date
number. In those cases, missing values will in general default to 0
for hours, minutes, seconds, will default to January for the month, and
1 for the day of month. The year will default to the current year.
Date strings with 2 character years are interpreted to be within the
100 years centered around the current year.

N = DATENUM(S,PIVOTYEAR) uses the specified pivot year as the
starting year of the 100-year range in which a two-character year
resides. The default pivot year is the current year minus 50 years.

N = DATENUM(S,F) uses the specified date form F to interpret the date string
S during the conversion to a date number N. The date form must be
composed of date format symbols according to Table 2 in DATESTR help.
See DATENUM(S) above for details. Formats with 'Q' are not accepted by
datenum.

N = DATENUM(S,F,P) or N = DATENUM(S,P,F) uses the specified date form F and
the pivot year P to determine the date number N, given the date string S.

The input can be a one-dimensional (row or column) string array or
cell array of strings; the resulting output is a column vector of date
numbers.

N = DATENUM(Y,M,D) and N = DATENUM([Y,M,D]) return the serial date
numbers for corresponding elements of the Y,M,D (year,month,day) arrays.
Y, M, and D must be arrays of the same size (or any can be a scalar).

N = DATENUM(Y,M,D,H,MI,S) and N = DATENUM([Y,M,D,H,MI,S]) return the
serial date numbers for corresponding elements of the Y,M,D,H,MI,S
(year,month,day,hour,minute,second) arrays. The six arguments must
be arrays of the same size (or any can be a scalar). Values outside
the normal range of each array are automatically carried to the next
unit (for example month values greater than 12 are carried to years).
Month values less than 1 are set to be 1; all other units can wrap
and have valid negative values.

Examples:
n = datenum('19-May-2000') returns n = 730625.
n = datenum(2001,12,19) returns n = 731204.
n = datenum(2001,12,19,18,0,0) returns n = 731204.75.
n = datenum('19.05.2000','dd.mm.yyyy') returns n = 730625.75.

See also now, datestr, datevec, datetick.

Reference page in Help browser
doc datenum

Saludos
Fismat
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar