Add additional information to data cursors

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

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by