title: Store orientation to an array - and compare
body: <p>I want to achieve the following:</p>
  
  <p>I want the user to be able to "record" the movement of the iPhone using the gyroscope. And after that, the user should be able to replicate the same movement. I extract the pitch, roll and yaw using:</p>
  
  <pre><code> [self.motionManager startDeviceMotionUpdatesToQueue:[NSOperationQueue currentQueue]
                                         withHandler: ^(CMDeviceMotion *motion, NSError *error)
       {
           CMAttitude *attitude = motion.attitude;
           NSLog(@"pitch: %f, roll: %f, yaw: %f]", attitude.pitch, attitude.roll, attitude.yaw);
       }];
  </code></pre>
  
  <p>I'm thinking that I could store these values into an array, if the user is in record mode. And when the user tries to replicate that movement, I'm could compare the replicated movement array to the recorded one. <strong>The thing is, how can I compare the two arrays in a smart way?</strong> They will never have exactly the same values, but they can be somewhat the same.</p>
  
  <p>Am I at all on the right track here?</p>
  
  <p><strong>UPDATE:</strong> I think that maybe Alis answer about using DTW could be the right way for me here. But I'm not that smart (apparently), so if anyone could help me out with the first steps with comparing to arrays I would be a happy man!</p>
  
  <p>Thanks!</p>