clear all;
clear m; %每次開始前清除m中資料
m = mobiledev;
m.Logging = 1;
pause(2); %有2秒時間取值
m.Logging = 0;
[ac, tac] = accellog(m); % accellog
x = ac(:,1); %只取X向量值
k=max(x); %取的所有x中抓出MAX值
pic=imread('0.PNG');
image(pic);
disp(max(x));
if max(x)>15 %每下一個if皆包含在前面的if中
pic=imread('1.png');
image(pic);
pause(0.5);
if max(x)>10
pic=imread('2.png');
image(pic);
pause(0.5);
if max(x)>14
pic=imread('3.png');
image(pic);
pause(0.5);
if max(x)>18
pic=imread('4.png');
image(pic);
pause(0.5);
if max(x)>22
pic=imread('5.png');
image(pic);
pause(0.5);
if max(x)>26
pic=imread('6.png');
image(pic);
pause(0.6);
if max(x)>30
pic=imread('7.png');
image(pic);
pause(0.6);
if max(x)>34
pic=imread('8.png');
image(pic);
pause(0.7);
if max(x)>38
pic=imread('9.png');
image(pic);
pause(0.7);
if max(x)>42
pic=imread('10.png');
image(pic);
pause(0.8);
end
end
end
end
end
end
end
end
end
load_system('final'); %進入simulink再傳回
sim('final');
b=max(a);
if b==1
pic=imread('K1.jpg');
image(pic);
pause(2);
elseif b==2
pic=imread('K2.jpg');
image(pic);
pause(2);
elseif b==3
pic=imread('K3.jpg');
image(pic);
pause(2);
elseif b==4
pic=imread('K4.jpg');
image(pic);
pause(2);
elseif b==5
pic=imread('K5.jpg');
image(pic);
pause(2);
end