Talking vending machine
1 次查看(过去 30 天)
显示 更早的评论
I'm current doing my final year project in Talking vending machine for blind, its full software project. How do i set command for each push button. Let say when the user press pushbutttonA the panel should diplay the name of the item and say it out at the same time. I know i have save the voice in wav file but i don't know how to execute the voice when the pushbutton is pressed. Can anyone help me in this. Its very helpful for me.
Thank in advance Sharmen
3 个评论
Jan
2011-2-25
What is a "pushbutton"? Do you mean an UICONTROL in a Matlab GUI? If so, how do blind people localize it?
采纳的回答
Paulo Silva
2011-2-25
If you are using GUIDE to build your GUI you just drag a button to the fig, click on the button with the mouse right button, view callback and select callback, matlab will show you the code that is executed when you press the button, insert the code you want to perform in there.
If you aren't using guide (doing all in a m file), you could just do this
fig=figure;
uicontrol('Style','pushbutton','String','Start',...
'Callback','disp(''You pushed the button'')',...
'Units','Normalized','Position',[0.5 0.5 0.1 0.1],...
'Parent',fig)
or
function samplegui
fig=figure;
uicontrol('Style','pushbutton','String','Start',...
'Callback',@pressingthebutton,...
'Units','Normalized','Position',[0.5 0.5 0.1 0.1],...
'Parent',fig)
function pressingthebutton(a,b)
disp('You pushed the button')
end
end
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Environment and Settings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!