3

To see what I mean excatly please:

  1. Run the code below

    figure
    plot(peaks)
    cameratoolbar('SetMode','orbit');
    cameratoolbar('Show');
    
  2. Move mouse onto the plot. Hold down the left click, move the mouse to left ot right then release the click. You'll see the plot start sniping for ever.

    Now if you click on the red, stop sign button it stops from spinning. However I would like to programmatically stop the spinning plot. Any thoughts?

Yamaneko
  • 3,433
  • 2
  • 38
  • 57
C graphics
  • 7,308
  • 19
  • 83
  • 134
  • I tried to execute commands while the plot was spinning. They are only executed after clicking in the STOP sign. It seems that, while the plot is spinning, MATLAB is kept busy running a kind of function. Only after clicking in the STOP sign, it is released to execute new commands. – Yamaneko Aug 16 '12 at 03:43

1 Answers1

0

Opening cameratoolbar in the editor reveals that orbiting is accomplished by setting the figure's WindowButton* callbacks temporarily to nested/sub functions within cameratoolbar.

Judging from the 1-minute diagonal read-through I did, the camera orbit itself is accomplished by calling a pan/zoom function orbitPangca, which recursively calls cameratoolbar. This recursion loop is controlled by flags which are toggled by the callbacks from the toolbar buttons. These flags alter the behaviour of each iteration in the recursion loop.

If this is indeed the case, it would imply that Matlab is not accepting commands from any source you have programmatic control over, while the plot is orbiting. It'll only respond to the button presses. This means that if you want to stop the motion programmatically, you'd have to hack cameratoolbar to allow for this - not the most portable option.

Another idea that just popped to mind, is figuring out which WindowButton* callback is used for the orbit, and define your own function there. You might just be lucky enough that the MathWorks implemented cameratoolbar such that both callbacks are called each iteration, which would give you programatic control over the flags. But -- you'd have to test this yourself.

Rody Oldenhuis
  • 37,726
  • 7
  • 50
  • 96