Clear Filters
Clear Filters

Why app designer does not set my modified DataTip in the plot? ERROR: UNABLE TO UPDATE

4 views (last 30 days)
My code is:
fig1 = figure('Name', "Graph");
Graph = digraph(app.G', app.U, 'omitselfloops'); %G and U are matrix and column vector
H = plot(Graph, 'NodeCData', R, 'MarkerSize', R*500, 'EdgeColor', [0.8 0.8 0.8]);
datacursormode on;
hdt = datacursormode(fig1);
disp(hdt);
hdt.UpdateFcn = @(obj, event_obj) app.GraphCursorCall(obj, event_obj, app.OUT, app.IN);
set(hdt, 'UpdateFcn', [@hdt.UpdateFcn] );
Matlab does not detect errors, but property of DataCursorManagement is not set and i don't know why.
The function to use is:
function output_txt = GraphCursorCall(~, event_obj, out, in)
% Display data cursor position in a data tip
% obj Currently not used
% event_obj Handle to event object
% output_txt Data tip text, returned as a character vector or a cell array of character vectors
pos = event_obj.Position;
output_txt = {['AGO ' num2str(pos(1), [1:length(out)])], ['OUTDEGREE: ' num2str(pos(2),out)], ['INDEGREE: ' num2str(pos(3),in)]};
end

Answers (0)

Categories

Find more on Develop Apps Using App Designer in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!