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

4 次查看(过去 30 天)
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

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Develop Apps Using App Designer 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by