MATLAB: Graphing Many Plots and Data Analysis

2 ビュー (過去 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 Center および File ExchangeAnnotations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by