MATLAB: Redrawing a content of a subplot in programmatic gui using dedicated control in another subplot

programmatic guisubplot handles

  • I am a novice in Matlab so this is a variation of a question asked in https://www.mathworks.com/matlabcentral/answers/311692-how-to-get-the-handles-of-a-subplot which I could not get running. To identify the problem, I drafted an example related to the management of handles and the use of callbacks to update subplots. The real case is a bit more complicated, but this one gives the idea.
  • The case is simple: we have three subplots. Top [1] and Bottom [3] subplots are populated with images and a panel with 3 buttons is located in the third spanning subplot [2,4]. The first and the third buttons should rotate the image in top and bottom subplots respectively and the third resets the image to restart the process.
  • Buttons partially work – they activate the actions in the target subplots
  • Pressing the buttons to redraw the panels after the rotation fails – why? any advice? thanks for your comments.

Best Answer

Update. The problem is solved using global to store the state of the image. It is not elegant but perhaps acceptable. Please share with me a solution that does not use global.
Related Question