Datatips in standalone apps do not work in Matlab 2019b

11 visualizaciones (últimos 30 días)
Alessandro Butte
Alessandro Butte el 1 de Mayo de 2020
Comentada: Nicolangelo Piscitelli el 24 de Nov. de 2023
I am developing an standalone app, where I want to show data tips in every plot to improve plot readibility. My experience is that this is working normally as long as I run the app from App Designer or within Matlab. However, as soon as I compile the app (I have Matlab 2019b) to create a desktop standalone app, the data tips are not shown anymore. This is true also for standard data tips, that is without customizing them dataTipTextRow.
To help solving my problem, I have created a very simple app to see if I make any mistake. This simple app is plotting the sine function between 0 and 2*pi().
Thanks in advance for any help, Alessandro
classdef TestApp < matlab.apps.AppBase
% Properties that correspond to app components
properties (Access = public)
UIFigure matlab.ui.Figure
UIAxes matlab.ui.control.UIAxes
AlphaEditFieldLabel matlab.ui.control.Label
AlphaEditField matlab.ui.control.NumericEditField
end
methods (Access = private)
function PlotSine(app)
% Initialize x
x = linspace(0,2*pi(),81);
% Compute sine
y = sin(app.AlphaEditField.Value*x);
% Plot
cla(app.UIAxes);
h = plot(app.UIAxes,x,y);
% Define plot characteristics
h.Marker = "o";
h.LineStyle = "-";
% Activate data tips
tb = axtoolbar(app.UIAxes,{'datacursor'});
end
end
% Callbacks that handle component events
methods (Access = private)
% Code that executes after component creation
function startupFcn(app)
% Initialize alpha
app.AlphaEditField.Value = 1;
% Plot sine curve
PlotSine(app);
end
% Value changed function: AlphaEditField
function ChangeAlpha(app, event)
% Plot sine curve with new alpha value
PlotSine(app);
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 = 'UI Figure';
% Create UIAxes
app.UIAxes = uiaxes(app.UIFigure);
title(app.UIAxes, 'Sine Function')
xlabel(app.UIAxes, 'x')
ylabel(app.UIAxes, 'sin(\alpha\cdotx)')
app.UIAxes.FontSize = 14;
app.UIAxes.XLim = [0 6.28318530717959];
app.UIAxes.YLim = [-1 1];
app.UIAxes.Box = 'on';
app.UIAxes.XGrid = 'on';
app.UIAxes.YGrid = 'on';
app.UIAxes.Position = [20 75 602 384];
% Create AlphaEditFieldLabel
app.AlphaEditFieldLabel = uilabel(app.UIFigure);
app.AlphaEditFieldLabel.HorizontalAlignment = 'right';
app.AlphaEditFieldLabel.FontSize = 16;
app.AlphaEditFieldLabel.Position = [156 26 215 22];
app.AlphaEditFieldLabel.Text = 'Enter Sine Frequency (alpha)';
% Create AlphaEditField
app.AlphaEditField = uieditfield(app.UIFigure, 'numeric');
app.AlphaEditField.Limits = [1e-06 Inf];
app.AlphaEditField.ValueChangedFcn = createCallbackFcn(app, @ChangeAlpha, true);
app.AlphaEditField.FontSize = 16;
app.AlphaEditField.Position = [386 26 100 22];
app.AlphaEditField.Value = 1;
% 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 = TestApp
% Create UIFigure and components
createComponents(app)
% Register the app with App Designer
registerApp(app, app.UIFigure)
% Execute the startup function
runStartupFcn(app, @startupFcn)
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

Respuestas (2)

Jacopo Remondina
Jacopo Remondina el 10 de Dic. de 2020
Any news about this issue? Is there a bug tracking code to follow?
I'm still experiencing it in matlab 2020b update 1, but with some differences:
  1. the black dot always display;
  2. The message window (customized) sometimes is displayed, and sometimes not;
  3. The problem happen both while using matlab itself and when the app is compiled
Notes:
GUI elements are all of the ui family, but I created them programmatically and not using appdesigner
Perhaps the problem is related to the fact that I have a tab group with a uiaxes in each tab (the last one is the one that work better and most of the times)
The custom function for generating the datatip text is fully executed (tested with console output)

Nidhi Mittal
Nidhi Mittal el 4 de Nov. de 2020
Hi Alessandro,
We are aware about this limitation and this feature may be supported in future releases.
Thanks,
Nidhi Mittal
  3 comentarios
Maximilian Gaukler
Maximilian Gaukler el 25 de Mzo. de 2021
Standard data tips (mouse click into any plot) work fine in an app compiled with R2021a.
Nicolangelo Piscitelli
Nicolangelo Piscitelli el 24 de Nov. de 2023
In Matlab2023a, no data tip is shown on scatter plots (compiled application). Is this a known issue?

Iniciar sesión para comentar.

Categorías

Más información sobre Develop uifigure-Based Apps en Help Center y File Exchange.

Productos


Versión

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by