Add additional information to data cursors

2 views (last 30 days)
J
J on 18 Aug 2015
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?

Answers (0)

Categories

Find more on MATLAB in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!