MATLAB: “Update traversal encountered invalid scene tree.” error while using AppDesigner

appdesignerMATLABSensor Fusion and Tracking Toolbox

Hello everyone, I am currently trying to represent the orientation of an object in a appdesigner interface i designed. I figured i can use the sensor fusion toolbox to visualize roll pitch and yaw data that i obtained from an external source. However, when i tried to plot it on a axes, it shows an empty 3d axes system and gives the error in the summary. It works just fine in MATLAB editor however i cannot make it work in appdesigner. Can you help me?
tp = theaterPlot('Parent',app.UIAxes7,'XLimit',[-2 2],'YLimit',[-2 2],'ZLimit',[-2 2]);
op = orientationPlotter(tp,'DisplayName','orientation','LocalAxesLength',2);
plotOrientation(op,roll(i),yaw(i),pitch)

Best Answer

Hi Kaan,
I suspect the error may be caused by something besides the orientationPlotter. I was able to create a simple app in appdesigner and update the orientationPlotter with roll, pitch, and yaw values.
Thanks,
Ryan
Here is the code used to try the simple app:
myApp = app1_exported;
roll = 0; pitch = 0; yaw = 45;
update(myApp, roll, pitch, yaw);
Here is the simple app:
classdef app1_exported < matlab.apps.AppBase
% Properties that correspond to app components
properties (Access = public)
UIFigure matlab.ui.Figure
UIAxes matlab.ui.control.UIAxes
OrientationPlot
end
methods (Access = public)
function update(app, roll, pitch, yaw)
plotOrientation(app.OrientationPlot, roll, pitch, yaw);
end
end
% Component initialization
methods (Access = private)
% Create UIFigure and components

function createComponents(app)
% Create UIFigure and hide until all components are created
app.UIFigure = uifigure('Visible', 'off');
app.UIFigure.Position = [100 100 640 480];
app.UIFigure.Name = 'MATLAB App';
% Create UIAxes
app.UIAxes = uiaxes(app.UIFigure);
title(app.UIAxes, 'Title')
xlabel(app.UIAxes, 'X')
ylabel(app.UIAxes, 'Y')
zlabel(app.UIAxes, 'Z')
app.UIAxes.Position = [171 149 300 185];
tp = theaterPlot('Parent',app.UIAxes,'XLimit',[-2 2],'YLimit',[-2 2],'ZLimit',[-2 2]);
op = orientationPlotter(tp,'DisplayName','orientation','LocalAxesLength',2);
plotOrientation(op, 0, 0, 0);
app.OrientationPlot = op;
% Show the figure after all components are created
app.UIFigure.Visible = 'on';
end
end
% App creation and deletion
methods (Access = public)
% Construct app
function app = app1_exported
% Create UIFigure and components
createComponents(app)
% Register the app with App Designer
registerApp(app, app.UIFigure)
if nargout == 0
clear app
end
end
% Code that executes before app deletion
function delete(app)
% Delete UIFigure when app is deleted
delete(app.UIFigure)
end
end
end