Add additional information to data cursors
이전 댓글 표시
Hello, I would like to add additional information to my data cursors on a plot I have. My code currently looks like this:
fig = figure('name','Flight Profile');
plot(TrkDistAbsInstr, interpolated.MSMC.Profiles(:), 'o')
xlabel('Track Distance [Nm]');
ylabel('Flight Level');
title('Flight Profile');
grid on
dcm = datacursormode(fig);
set(dcm, 'UpdateFcn', @ATCInstructionsDataCursorFunction, 'SnapToDataVertex', 'on');
datacursormode on % sets the mouse to default to a data cursor
Where the code for ATCInstructionsDataCursorFunction is:
function [output_txt] = ATCInstructionsDataCursorFunction(~,event_obj)
pos = get(event_obj, 'Position');
idx3 = get(event_obj, 'DataIndex');
output_txt = {['Track Distance [Nm]: ',num2str(pos(1))],...
['Flight Level: ',num2str(pos(2))],...
['Instruction Index: ',num2str(idx3)]};
end
This gives me a dataplot with the Track Distance, Flight Level and Index on the datacursor. I would like to add additional information to the datacursor, that I have stored in another structure, EFPS_Combined.action
How can I get say,
EFPS_Combined.action(x) % where x = 1:17
To display the value of EFPS_Combined.action(x) on the xth datapoint?
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!