Getting an Age from Dataset
Mostrar comentarios más antiguos
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
Adam
el 19 de Oct. de 2021
Depends which age you want.
allSamples{ 1, 2:3 }
would give you the first DOB and collection date. Or
[ allSamples.DOB, allSamples.CollectionDate ]
will give you the full column of dates of birth and collection date.
Then it is easy to calculate age from these.
Alana Mera
el 20 de Oct. de 2021
One possibility —
DOB = datetime(['06 Jul 1951'; '15 Aug 1943'], 'InputFormat','dd MMM yyyy')
CollectionDate = datetime(['01 Mar 2006'; '02 Mar 2006'], 'InputFormat','dd MMM yyyy')
Age = caldiff([DOB CollectionDate], {'years' 'months' 'days'}, 2)
.
Respuestas (1)
Arunoda shehani
el 26 de Mayo de 2023
0 votos
matlab code to determine birthday when enter the NIC number
Categorías
Más información sobre Birthdays en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!