ButtonDownFcn function question on guitar tuner

1 回表示 (過去 30 日間)
John Bitzios
John Bitzios 2014 年 8 月 11 日
コメント済み: John Bitzios 2014 年 8 月 13 日
Hi there! I am trying to figure out what this part of the code does.( Program link http://www.mathworks.com/matlabcentral/fileexchange/26367-guitar-tuner/content/GuitarTuner.m )
function figure1_ButtonDownFcn(hObject, eventdata, handles) % hObject handle to figure1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
The comment says "Executes on mouse press over figure background." I need more information on this one though because all you have to do when the program runs is to click on the "rec" button and play the note you want , so that the tuner shows you whether the note you hit is correct or not. Does this part of code appear when you do something specific when setting up stuff on GUI??

採用された回答

Joakim Magnusson
Joakim Magnusson 2014 年 8 月 11 日
編集済み: Joakim Magnusson 2014 年 8 月 11 日
There is no code in the buttonDownFcn, it don't seem to do anything and seems unnecessary? Anyway if you open the .fig file in guide and dubbelclick in the background so the property inspector appears for the figure. There you can see buttondownFcn and right to the text there is a button, if you click on that button the part of code you asked about is auto-generated.
  5 件のコメント
John Bitzios
John Bitzios 2014 年 8 月 11 日
I deleted the part of the code that included ButtonDownFcn but the program still works fine...I dont see the importance of this code...
Joakim Magnusson
Joakim Magnusson 2014 年 8 月 12 日
I would guess it was just leftovers that someone forgot to remove.

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

その他の回答 (2 件)

Joakim Magnusson
Joakim Magnusson 2014 年 8 月 13 日
at function playbutton1_Callback(hObject, eventdata, handles) it says set(hObject,'CData',PlayEnabled);
What is CData and how can it become PlayEnabled?? What other parameters can CData take??
I belive CData has something to do with the buttons appaerance and i think PlayEnabled is just what the author named the appearance to.
  1 件のコメント
John Bitzios
John Bitzios 2014 年 8 月 13 日
Damn right my friend! Now I noticed that it is attached to the buttonicons section!!

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


John Bitzios
John Bitzios 2014 年 8 月 12 日
at function playbutton1_Callback(hObject, eventdata, handles) it says set(hObject,'CData',PlayEnabled);
What is CData and how can it become PlayEnabled?? What other parameters can CData take??

カテゴリ

Help Center および File ExchangeInteractive Control and Callbacks についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by