Hello all,
I have an annoying little problem in Matlab that I fail to understand and don't know how to solve. Whenever I am making an app in AppDesigner, and I want to switch or change the built-in axes interactions, the app only becomes responsive if moving my mouse away from the UIAxis, onto a different item, and then moving back.
Attached is a small demonstrator app that shows the behaviour. This app plots a random 3D line with its default [rotate zoom]-interactions. When I press the Control-key it will switch this default interaction to [pan zoom]-interactions. Again pressing control will switch back (effectively toggling the behaviour).
However, upon pressing control (without moving the mouse) it will disable any interaction. Clicking and dragging the mouse will not do anything. Only when the mouse is moved off the UIAxes, onto some other part of the app (for example, a panel), and then back again, the interactions will function (and indeed be switched).
This is the main snippet of code that should hopefully make it clear:
app.Store.InteractionType = true;
app.Store.Data = rand([10 3]);
app.Store.Plot = plot3(app.UIAxes, app.Store.Data(:,1), app.Store.Data(:,2), app.Store.Data(:,3), ...
LineWidth=2, Marker="o", MarkerEdgeColor=[1.0 0.6 0.6], MarkerFaceColor=[1.0 0.0 0.0]);
function UIFigureKeyPress(app, event)
if strcmpi(event.Key, 'control')
if app.Store.InteractionType
app.UIAxes.Interactions = [panInteraction zoomInteraction];
app.Store.InteractionType = false;
app.UIAxes.Interactions = [rotateInteraction zoomInteraction];
app.Store.InteractionType = true;
Am I doing something wrong? How can I make sure the app will function immediately after releasing the control button?