You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 5, 2019. It is now read-only.
MATLAB throws an error when attempting to utilize some legtools methods with an empty legend handle. This is due to the implicit assumption that the methods are being called on a non-empty legend handle.
For example:
% Set up figure
x = 1:10;
y1 = x;
figure
plot(x, y1);
lh = legend;
% Add box
dim = [0.4 0.4 0.2 0.2];
annotation('rectangle', dim, 'Color', 'red')
% Add a legend entry
legtools.adddummy(lh, 'A Red Rectangle', {'Color', 'red'})
Throws an uncaught error:
Expected one output from a curly brace or dot indexing expression, but there were 0 results.
Error in legtools.adddummy (line 179)
parentaxes = lh.PlotChildren(1).Parent;
Error in testcode (line 13)
legtools.adddummy(lh, 'A Red Rectangle', {'Color', 'red'})