フィルターのクリア

undefined fuction 'buttonDownCallBack' for input argument

4 ビュー (過去 30 日間)
haejun
haejun 2017 年 2 月 16 日
コメント済み: Adam 2017 年 2 月 16 日
Hi I am trying to run the code below, but when I click a data point on the figure, I got an error saying, " Undefined function 'buttonDownCallback' for input arguments of type 'matlab.graphics.chart.primitive.Line' " Any help would be appreciated.
I am using 2016a, academic use.
Thanks,
A = [0 0.209718 1 0.209523 2 0.209523 3 0.209523 4 0.209523 5 0.209508 6 0.209483 7 0.209483 8 0.209533 9 0.209533 10 0.209488 11 0.209518 12 0.209518 ];
fh = figure;
h = plot(A(:,1), A(:,2), 'o');
legend(h);
set(h, 'ButtonDownFcn',@buttonDownCallback);
waitfor(fh);
defaultanswer = {'30'};
inputdlg('Type in the ignition time(s)',dlg_title,1, defaultanswer);

回答 (1 件)

Adam
Adam 2017 年 2 月 16 日
Well, from what you have shown, the obvious answer is that you haven't defined a function called 'buttonDownCallback' just as the error states.
You need to define the function, taking two input arguments for the source and event data.
  2 件のコメント
haejun
haejun 2017 年 2 月 16 日
編集済み: Adam 2017 年 2 月 16 日
I thought this is an inherent function. I do not get this error for practically the same code as below. Thanks,
TCforX = [34, 41];% the top two thermocouples in the compartment
fh = figure;
h = zeros(1,length(TCforX));
hold on;
timeTC = [0:1:length(allTC)-1];
for i = 1:length(TCforX)
n = TCforX(i);
h(i) = plot(timeTC, allTC(:,n), 'o','DisplayName', sprintf('TC%d', n));
end
legend(h)
set(h, 'ButtonDownFcn',@buttonDownCallback);
waitfor(fh);
Adam
Adam 2017 年 2 月 16 日
Well, assuming you click on the plot you should get the same error in that case.
The point of 'ButtonDownFcn' is to enable you to add your own behaviour when you click on an image or axes or any graphics object so having an inherent function for this wouldn't make much sense. What would its functionality be?

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeGraphics Object Programming についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by