Getting an Age from Dataset

12 visualizaciones (últimos 30 días)
Alana Mera
Alana Mera el 19 de Oct. de 2021
Respondida: Arunoda shehani el 26 de Mayo de 2023
I'm trying to get an age from the following data in a matrix array/table, just unsure how to apply the code to my work. If anyone could help it would be amazing!
  3 comentarios
Alana Mera
Alana Mera el 20 de Oct. de 2021
How do i calculate the age?
Star Strider
Star Strider el 20 de Oct. de 2021
One possibility —
DOB = datetime(['06 Jul 1951'; '15 Aug 1943'], 'InputFormat','dd MMM yyyy')
DOB = 2×1 datetime array
06-Jul-1951 15-Aug-1943
CollectionDate = datetime(['01 Mar 2006'; '02 Mar 2006'], 'InputFormat','dd MMM yyyy')
CollectionDate = 2×1 datetime array
01-Mar-2006 02-Mar-2006
Age = caldiff([DOB CollectionDate], {'years' 'months' 'days'}, 2)
Age = 2×1 calendarDuration array
54y 7mo 23d 62y 6mo 15d
.

Iniciar sesión para comentar.

Respuestas (1)

Arunoda shehani
Arunoda shehani el 26 de Mayo de 2023
matlab code to determine birthday when enter the NIC number

Categorías

Más información sobre Birthdays 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