MATLAB: CalendarDuration with a number (double)

calendardurationcomparedifferenceMATLABtime

Dear All
I am trying to compare calendarDuration with a number. For e.g. I have an array with time in the format "dd-MMM-yy hh:mm:ss.SSS". I need to find the difference between them by looping through them only if the time is greater than 0.5s (500ms). It is important to note than the values are within a few (milli)seconds between each other i.e. multiple values are generated every minute/second thereby rendering 'dd-MMM-yy hh:' useless.
Example:
if dd-MMM-yy hh:mm:ss.SSS(x,1) – dd-MMM-yy hh:mm:ss.SSS(x-1,1) > 0.5 [ i.e. Row 2 – Row 1 > 0.5]
then store the value in an array (diffArray)
else store 0 and compute if dd-MMM-yy hh:mm:ss.SSS(x+1,1) – dd-MMM-yy hh:mm:ss.SSS(x-1,1) > 0.5 [i.e.Row 3 – Row 1 > 0.5]
then store the value in diffArray
else store 0 and go to the subsequent row [i.e. Row4 – Row1 > 0.5]
The idea is to store differences between rows which are greater than 0.5s (else store 0). The next value greater than 0.5 could be in the next row or some row after the next and so on…
The problem is that I cant use '>' for calendarDuration. I get the error "Undefined operator '>' for input arguments of type 'calendarDuration'."

Best Answer

Datas=seconds(array-array(1)); % array in format "dd-MMM-yy hh:mm:ss.SSS"
Now use Datas for comparison.
Related Question