Advertisement
Guest User

Untitled

a guest
Jun 27th, 2016
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.03 KB | None | 0 0
  1. function submitButton_Callback(hObject, eventdata, handles)
  2. % hObject handle to submitButton (see GCBO)
  3. % eventdata reserved - to be defined in a future version of MATLAB
  4. % handles structure with handles and user data (see GUIDATA)
  5. if(get(handles.HitButton,'Value') == 1)
  6. filename = 'testing.xls';
  7. writevar({'Hit'},1,filename);
  8. set(handles.text2,'visible','off');
  9. set(handles.words,'visible','off');
  10. set(handles.rating,'visible','on');
  11. set(handles.readyToGo,'visible','off');
  12. set(handles.readyButton,'visible','off');
  13. set(handles.submitButton,'visible','off');
  14. set(handles.rateButton, 'visible','on');
  15. set(handles.HowSure,'visible', 'on');
  16. drawnow;
  17. sPort=serial('COM4');
  18. fopen(sPort);
  19. fprintf(sPort, '%d', 3);
  20. fclose(sPort);
  21. delete(sPort);
  22. else
  23. filename = 'testing.xls';
  24. writevar({'Bit'},1,filename);
  25. set(handles.text2,'visible','off');
  26. set(handles.words,'visible','off');
  27. set(handles.rating,'visible','on');
  28. set(handles.readyToGo,'visible','off');
  29. set(handles.readyButton,'visible','off');
  30. set(handles.submitButton,'visible','off');
  31. set(handles.rateButton, 'visible','on');
  32. set(handles.HowSure,'visible', 'on');
  33. drawnow;
  34. sPort=serial('COM4');
  35. fopen(sPort);
  36. fprintf(sPort, '%d', 3);
  37. fclose(sPort);
  38. delete(sPort);
  39. end
  40. function readyButton_Callback(hObject, eventdata, handles)
  41. % hObject handle to readyButton (see GCBO)
  42. % eventdata reserved - to be defined in a future version of MATLAB
  43. % handles structure with handles and user data (see GUIDATA)
  44. s = load('train.mat');
  45. sPort=serial('COM4');
  46. fopen(sPort);
  47. fprintf(sPort, '%d', 1);
  48. player = audioplayer(s.y,8192);
  49. playblocking(player);
  50. fprintf(sPort, '%d', 2);
  51. fclose(sPort);
  52. delete(sPort);
  53. %pause(4);
  54. set(handles.text2,'visible','on');
  55. set(handles.words,'visible','on');
  56. set(handles.HowSure,'visible', 'off');
  57. set(handles.rating,'visible','off');
  58. set(handles.readyToGo,'visible','off');
  59. set(handles.readyButton,'visible','off');
  60. set(handles.submitButton,'visible','on');
  61. drawnow;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement