Getting an Age from Dataset

조회 수: 8 (최근 30일)
Alana Mera
Alana Mera 2021년 10월 19일
답변: Arunoda shehani 2023년 5월 26일
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
Alana Mera
Alana Mera 2021년 10월 20일
How do i calculate the age?
Star Strider
Star Strider 2021년 10월 20일
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
.

댓글을 달려면 로그인하십시오.

답변 (1개)

Arunoda shehani
Arunoda shehani 2023년 5월 26일
matlab code to determine birthday when enter the NIC number

카테고리

Help CenterFile Exchange에서 Birthdays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by