Sending data continuously when pushbutton is being pressed

I am working on a GUI in matlab. I want it to behave it such that when pushbutton is pressed,data behind it transmits continuously till the right click of mouse is released.Below code is in the callback of a pushbutton.
% --- Executes on button press in pushbutton4.
function pushbutton4_Callback(~, ~, ~)
% hObject handle to pushbutton4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)x
global obj1;
fprintf(obj1,'A');
How should i do it. Also, what'll be the difference if I put above code in the other callback functions of same pushbutton.

回答 (1 件)

Image Analyst
Image Analyst 2017 年 4 月 30 日

0 投票

I'm not sure a pushbutton can operate like that. But if it can, you'd have to define the ButtonDownFcn function for it. Look in the property inspector and click on the little button. When I tried it, it didn't work though.

1 件のコメント

Ahmer Ahmed
Ahmer Ahmed 2017 年 5 月 1 日
Thanks for feedback. I have tried using Buttondownfcn but to no avail.

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

カテゴリ

製品

質問済み:

2017 年 4 月 30 日

コメント済み:

2017 年 5 月 1 日

Community Treasure Hunt

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

Start Hunting!

Translated by