function varargout = MM2(varargin)% MM2 MATLAB code for MM2.fig% MM2, by itself, creates a new MM2 or raises the existing% singleton*.%% H = MM2 returns the handle to a new MM2 or the handle to% the existing singleton*.%% MM2('CALLBACK',hObject,eventData,handles,...) calls the local% function named CALLBACK in MM2.M with the given input arguments.%% MM2('Property','Value',...) creates a new MM2 or raises the% existing singleton*. Starting from the left, property value pairs are% applied to the GUI before MM2_OpeningFcn gets called. An% unrecognized property name or invalid value makes property application% stop. All inputs are passed to MM2_OpeningFcn via varargin.%% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one% instance to run (singleton)".%% See also: GUIDE, GUIDATA, GUIHANDLES% Edit the above text to modify the response to help MM2% Last Modified by GUIDE v2.5 14-Jun-2019 22:20:44% Begin initialization code - DO NOT EDITgui_Singleton = 1;gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @MM2_OpeningFcn, ... 'gui_OutputFcn', @MM2_OutputFcn, ... 'gui_LayoutFcn', [] , ... 'gui_Callback', []);if nargin && ischar(varargin{1}) gui_State.gui_Callback = str2func(varargin{1});endif nargout [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});else gui_mainfcn(gui_State, varargin{:});end% End initialization code - DO NOT EDIT% --- Executes just before MM2 is made visible.function MM2_OpeningFcn(hObject, eventdata, handles, varargin)% This function has no output args, see OutputFcn.% hObject handle to figure% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% varargin command line arguments to MM2 (see VARARGIN)% Choose default command line output for MM2handles.output = hObject;% Update handles structureguidata(hObject, handles);% UIWAIT makes MM2 wait for user response (see UIRESUME)% uiwait(handles.figure1);% --- Outputs from this function are returned to the command line.function varargout = MM2_OutputFcn(hObject, eventdata, handles) % varargout cell array for returning output args (see VARARGOUT);% hObject handle to figure% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Get default command line output from handles structurevarargout{1} = handles.output;start=imread('bg.jpg');axes(handles.axes1);imshow(start);[y,fs]=audioread(['C:\Users\璐\Documents\MATLAB\bgm.mp3']);global bgm yes wrongbgm = audioplayer(y,fs);[y,fs]=audioread(['C:\Users\璐\Documents\MATLAB\yes.mp3']);yes = audioplayer(y,fs);[y,fs]=audioread(['C:\Users\璐\Documents\MATLAB\wrong.mp3']);wrong = audioplayer(y,fs);function pushbutton1_Callback(hObject, eventdata, handles)% hObject handle to pushbutton1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)global bgm yes wrong play(bgm);set (handles.pushbutton1,'Visible','off');pic=imread('3.png');imshow(pic);pause(1);pic=imread('2.png');imshow(pic);pause(1);pic=imread('1.png');imshow(pic);pause(1);pic=imread('start.png');imshow(pic);pause(1);number = 0;for i = 1:10 m = mobiledev; x = randi([1,5]); m.Logging= 1; set (handles.score,'Visible','On'); if(x == 1) pic=imread('up.jpg'); imshow(pic); end if (x == 2) pic=imread('down.jpg'); imshow(pic); end if (x == 3) pic=imread('center.jpg'); imshow(pic); end if (x == 4) pic=imread('left.jpg'); imshow(pic); end if (x == 5) pic=imread('right.jpg'); imshow(pic); end pause(3); m.Logging= 0; p = m.Orientation(2); r = m.Orientation(3); assignin('base','p',p); assignin('base','r',r); load_system('mm'); sim('mm'); y=a(1,1); if(y == x) play(yes); number = number+1; set (handles.score,'String',number); pause(1); else play(wrong); pause(1); end clear x m;endset (handles.score,'Visible','off');set (handles.text3,'Visible','On');set (handles.text4,'String',number);set (handles.text4,'Visible','On');stop(bgm);