How to use dbscan for durations ?

조회 수: 29 (최근 30일)
Sim
Sim 2022년 11월 3일
댓글: Sim 2022년 11월 8일
How can I use dbscan for time durations ?
A = duration({'00:01:01'
'00:00:53'
'00:00:55'
'00:00:54'
'00:00:54'
'00:00:53'
'02:45:08'
'00:01:33'
'00:00:57'
'00:00:58'
'00:00:51'
'00:00:45'
'00:01:03'
'00:00:56'
'00:00:45'
'00:26:52'
'00:01:12'
'00:00:41'
'00:00:56'
'00:01:16'
'00:01:47'
'00:09:22'
'00:00:40'
'00:00:38'
'00:00:48'
'00:00:38'
'00:00:42'
'00:00:42'
'00:01:06'
'00:01:00'
'00:00:43'
'00:00:47'
'00:00:43'
'00:00:50'
'00:00:52'
'00:01:20'
'00:01:35'
'00:00:54'
'00:01:05'
'00:02:07'
'00:00:43'
'00:00:39'
'00:29:36'
'00:00:39'
'00:00:39'
'00:01:01'
'00:01:09'
'00:01:12'
'00:01:11'
'00:01:12'
'00:01:06'
'00:01:06'
'00:01:00'
'00:01:15'
'00:01:08'
'00:00:39'
'00:00:59'
'00:00:54'
'00:01:25'
'00:01:01'
'00:01:03'
'00:01:03'
'00:00:56'
'00:01:19'
'00:01:05'
'00:01:00'
'00:01:09'
'00:01:12'
'00:00:52'
'00:00:40'
'00:01:09'
'00:01:00'
'00:01:04'
'00:00:57'
'00:02:07'
'00:02:44'
'00:00:51'
'00:01:22'
'00:01:10'
'00:01:07'
'00:01:07'
'00:00:48'
'00:00:59'
'00:01:02'
'00:00:48'
'00:00:49'
'00:00:56'
'00:01:03'
'00:00:53'
'00:01:23'
'00:00:40'
'00:01:25'
'00:01:15'
'00:01:13'
'00:02:14'
'00:01:08'
'00:00:53'
'00:01:00'})
A = 98×1 duration array
00:01:01 00:00:53 00:00:55 00:00:54 00:00:54 00:00:53 02:45:08 00:01:33 00:00:57 00:00:58 00:00:51 00:00:45 00:01:03 00:00:56 00:00:45 00:26:52 00:01:12 00:00:41 00:00:56 00:01:16 00:01:47 00:09:22 00:00:40 00:00:38 00:00:48 00:00:38 00:00:42 00:00:42 00:01:06 00:01:00
dbscan(A)
Error using dbscan
Expected X to be one of these types:

single, double, logical

Instead its type was duration.

채택된 답변

Cris LaPierre
Cris LaPierre 2022년 11월 3일
As with your earlier question, convert your durations to numeric values using minutes. You can later convert it back to durations also using minutes.
A = duration('00:01:01')
A = duration
00:01:01
B = minutes(A)
B = 1.0167
C = minutes(B)
C = duration
1.0167 min
C.Format = 'hh:mm:ss'
C = duration
00:01:01
  댓글 수: 3
Cris LaPierre
Cris LaPierre 2022년 11월 3일
datenum is not recommended. To represents points in time, use datetime arrays. To represent elapsed times, use duration or calendarDuration arrays. For more information on updating your code, see Version History or Replace Discouraged Instances of Serial Date Numbers and Date Strings.
Sim
Sim 2022년 11월 8일
Really thankful @Cris LaPierre !!!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Dates and Time에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by