# MATLAB: Confusing problem about duration data

MATLAB

Hi,
I'm having a very confusing issue when I'm operating with duration data. I'm new to this data type. Here I debugged my code and simplify my question as an example. Please can someone point out the root reason of why this is not working. Basically, I first define a duration x and with this x, I want to create a new x1 with a random duration, like in the example. I describe my confusion as below. Can anyone help me out? I know it might be the problem of using rand but why?
``x = duration(8,0,47);>> x1 = x + rand*duration(0,0,10);>> x1x1 =   duration   08:00:54``
However, I realize though x1 is of type of duration, it does not equal to the duration 08:00:54.
``   >> x1 == duration(8,0,54)ans =  logical   0``
Nevertheless, if I define a new x2 in a similar way, it works.
``   >> x2 = x + duration(0,0,7);>> x2x2 =   duration   08:00:54>> x2 == duration(8,0,54)ans =  logical   1``
And x1 apparently doesn't equal to x2.
``>> x1 == x2ans =  logical   0``

``x1.Format = 'hh:mm:ss.SSSSSSSSS';``