MATLAB: Graphing Many Plots and Data Analysis

조회 수: 1 (최근 30일)
Sarah Crimi
Sarah Crimi 2018년 5월 31일
댓글: Vincent BARALE 2020년 9월 25일
My question is about plotting many sets of x-y data in one plot. I want to know how I can make it so that if I select one point on the plot, it will tell me which plot is being selected at the same time it tells the x and y data. I figured out how to create a Callback function that can change the datatip of the plot to display this information (which I will paste below), but I don't know how to change the Text Update Function in an m-file instead of right clicking on the plot and selecting "select Text Update Function" and selecting the function Thanks. Sarah C.
function output_txt = myfunction(obj,event_obj) % Display the position of the data cursor % obj Currently not used (empty) % event_obj Handle to event object % output_txt Data cursor text string (string or cell array of strings).
pos = get(event_obj,'Position'); I = get(event_obj, 'DataIndex');
output_txt = {['X: ',num2str(pos(1),4)],... ['Y: ',num2str(pos(2),4)],... ['legend: ', event_obj.Target.DisplayName],['I: ',num2str(I)]} % If there is a Z-coordinate in the position, display it as well %if length(pos) > 2 % output_txt{end+1} = ['Z: ',num2str(pos(3),4)]; end
  댓글 수: 1
Vincent BARALE
Vincent BARALE 2020년 9월 25일
Hello, I have the same question and still don't find answer.
Maybe this post may help you, but I dif'n find the script in my files
Vincent

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by