title: Matlab: Add additional info to the data cursor for multiple data sets
body: <p>I am trying to add additional data to the cursor in a plot similar to <a href="http://www.mathworks.com/matlabcentral/answers/68079-how-to-add-additional-info-to-the-data-cursor" rel="nofollow">1</a> however, I have multiple data sets. How can I have the data cursor pull from two data sets.</p>
  
  <pre><code>function test
      x1 = 1:10;
      x2 = 1:0.5:10;
  
      y1 = cos(x1);
      y2 = sin(x2);
  
      z1 = rand(size(x1));
      z2 = rand(size(x2));
  
      fig = figure;
      plot(x1, y1, x2, y2)
      dcm_obj = datacursormode(fig);
      datacursormode on
  
      set(dcm_obj,'updatefcn',{@myupdatefcn, {z1, z2}})
  end
  
  function txt = myupdatefcn(x,event_obj,t)
      % Customizes text of data tips
      pos = get(event_obj,'Position');
      I = get(event_obj, 'DataIndex');
      txt = {['V: ',num2str(pos(1))],...
             ['j: ',num2str(pos(2))],...
             ['z: ',num2str(t(I))]};
  end
  </code></pre>