1 打开matlab,打开test1.m

点击运行,若出现选择 更改文件夹

2  引导界面

(在这个界面,只许用户鼠标点击开始,其余的别乱按按键。 记得将打字法关掉,切换到小写)

3 做题界面

根据颜色选择按键,直到做完题。80到题

界面出现,鼠标一定要点击下界面,不然键盘按键无效不起作用。

4结果

这里只统计正确的次数以及对应累加的时间。

2文件

function varargout = test1(varargin)
% TEST1 MATLAB code for test1.fig
% TEST1, by itself, creates a new TEST1 or raises the existing
% singleton*.
%
% H = TEST1 returns the handle to a new TEST1 or the handle to
% the existing singleton*.
%
% TEST1('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in TEST1.M with the given input arguments.
%
% TEST1('Property','Value',...) creates a new TEST1 or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before test1_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to test1_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 test1 % Last Modified by GUIDE v2.5 13-Jan-2019 00:41:34 % Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @test1_OpeningFcn, ...
'gui_OutputFcn', @test1_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end global t0;
t0=clock; % --- Executes just before test1 is made visible.
function test1_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 test1 (see VARARGIN) % Choose default command line output for test1
handles.output = hObject; % Update handles structure
guidata(hObject, handles); % UIWAIT makes test1 wait for user response (see UIRESUME)
% uiwait(handles.figure1); % --- Outputs from this function are returned to the command line.
function varargout = test1_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 structure
varargout{1} = handles.output; function [color_c] = tran_keytocolor(Key)
%判断是否正确
color_c='';
switch Key
case 'a'
color_c='r';%红色
case 's'
color_c='g'; %绿色
case 'd'
color_c='b';%蓝色
case 'f'
color_c='y';%黄色 otherwise
warning('按键无效! 请选择 a s d f 按键!');
end function [num_r] = tran_leibie(idv,handles)
%判断是否正确
num_r=''; switch idv % 判断随机图的题型类
case '1'
num_r= handles.r1;
case '2'
num_r= handles.r2;
case '3'
num_r= handles.r3;
case '4'
num_r= handles.r4;
otherwise
warning('题目类型找不到!');
end % --- Executes on key press with focus on figure1 and none of its controls.
function figure1_KeyPressFcn(hObject, eventdata, handles)
% hObject handle to figure1 (see GCBO)
% eventdata structure with the following fields (see MATLAB.UI.FIGURE)
% Key: name of the key that was pressed, in lower case
% Character: character interpretation of the key(s) that was pressed
% Modifier: name(s) of the modifier key(s) (i.e., control, shift) pressed
% handles structure with handles and user data (see GUIDATA)
% 定义 a s d f g h j 按键对应颜色
% 获取题号
all_number=80; num=get(handles.text_num,'Value'); global word;
global color;
global randi5_16; word={
'1', '1', '1', '1', '2', '2', '2', '2', '3', '3', '3', '3', '4', '4', '4' , '4';
'红', '绿', '蓝', '黄' ,'红', '绿', '蓝', '黄' , '我', '爱', '中', '国','洪', '皇', '拦', '滤';
}; color={'r', 'g', 'b', 'y' ,'g', 'b', 'y' , 'r' , 'r', 'y', 'b', 'g', 'g', 'b', 'y ', 'r';}; randi5_16=[1 5 9 13 2 6 10 14 3 7 11 15 4 8 12 16 2 6 10 14 4 8 12 16 1 5 9 13 3 7 11 15 10 14 4 8 9 13 3 7 11 15 1 5 12 16 2 6 4 8 9 13 12 16 2 6 10 14 3 7 11 15 1 5 9 13 12 16 3 7 11 15 2 6 10 14 1 5 4 8;]; %1获取按键
Key= get(gcf,'CurrentCharacter');
%按键转换成颜色
color_c = tran_keytocolor(Key);
% warning(color_c);
%2 判断是哪个随机图
ID=handles.randid; if Key =='a'|| Key =='s' || Key =='d'|| Key =='f' & num<=all_number %判断按下的是否是回车键 global t1;
t1=clock;
global t0;
handles.time.Value=etime(t1, t0);
handles.time.String=handles.time.Value;
t0=clock; %2获取当前显示字体控件
text_show1=handles.text_show; %3 获取题目类别
leibie_num=word{1,ID.Value};
if leibie_num=='1'
if handles.color_temp.String==color_c & num<=all_number
num_r= handles.r1;
set(num_r, 'Value',num_r.Value+1);
set(num_r, 'String',num_r.Value);
handles.t1.Value= handles.t1.Value+ handles.time.Value;
handles.t1.String= handles.t1.Value;
end
elseif leibie_num=='2'
if handles.color_temp.String==color_c & num<=all_number
num_r= handles.r2;
set(num_r, 'Value',num_r.Value+1);
set(num_r, 'String',num_r.Value);
handles.t2.Value= handles.t2.Value+ handles.time.Value;
handles.t2.String= handles.t2.Value;
end
elseif leibie_num=='3'
if handles.color_temp.String==color_c & num<=all_number
num_r= handles.r3;
set(num_r, 'Value',num_r.Value+1);
set(num_r, 'String',num_r.Value);
handles.t3.Value= handles.t3.Value+ handles.time.Value;
handles.t3.String= handles.t3.Value;
end
elseif leibie_num=='4'
if handles.color_temp.String==color_c & num<=all_number
num_r= handles.r4;
set(num_r, 'Value',num_r.Value+1);
set(num_r, 'String',num_r.Value);
handles.t4.Value= handles.t4.Value+ handles.time.Value;
handles.t4.String= handles.t4.Value;
end
end % 修改题号+1
if num<=all_number-1
temp1=handles.text_num;
set(temp1, 'Value',num+1);
set(temp1, 'String',num+1); %ID1=randi(16,1);
ID1=randi5_16(temp1.Value); set(ID, 'Value',randi5_16(temp1.Value));
set(ID, 'String',randi5_16(temp1.Value));
set(text_show1, 'String',word(2,randi5_16(temp1.Value)));
set(text_show1, 'ForegroundColor',color{randi5_16(temp1.Value)});
set(handles.color_temp, 'String',color{randi5_16(temp1.Value)});
else temp1=handles.text_num;
set(temp1, 'Value',all_number+1);
open('result.fig') handles.text10.Visible='on';
handles.text11.Visible='on';
handles.text14.Visible='on';
handles.text15.Visible='on';
handles.text16.Visible='on'; handles.text12.Visible='on';
handles.r1.Visible='on';
handles.r2.Visible='on';
handles.r3.Visible='on';
handles.r4.Visible='on'; handles.text8.Visible='on';
handles.t1.Visible='on';
handles.t2.Visible='on';
handles.t3.Visible='on';
handles.t4.Visible='on'; end
end % --- Executes on button press in pushbutton1.
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) % --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
handles.text32.Visible='off';
handles.text36.Visible='off';
handles.text38.Visible='off';
handles.pushbutton2.Visible='off';
handles.text_show.Visible='on';
global t0;
t0=clock; % --- Executes on key press with focus on pushbutton2 and none of its controls.
function pushbutton2_KeyPressFcn(hObject, eventdata, handles)
% hObject handle to pushbutton2 (see GCBO)
% eventdata structure with the following fields (see MATLAB.UI.CONTROL.UICONTROL)
% Key: name of the key that was pressed, in lower case
% Character: character interpretation of the key(s) that was pressed
% Modifier: name(s) of the modifier key(s) (i.e., control, shift) pressed
% handles structure with handles and user data (see GUIDATA) handles.text32.Visible='off';
handles.text36.Visible='off';
handles.text38.Visible='off';
handles.pushbutton2.Visible='off';
handles.text_show.Visible='on';
global t0;
t0=clock;

  

stroop效应matlab实验的更多相关文章

  1. FFT的分析以及matlab实验

    FFT(Fast Fourier Transformation),即为快速傅氏变换,是离散傅氏变换(DFT)的快速算法. 采样得到的数字信号,做FFT变换,N个采样点,经过FFT之后,就可以得到N个点 ...

  2. 边缘检测算子和小波变换提取图像边缘【matlab】

    Roberts边缘检测算子:根据一对互相垂直方向上的差分可用来计算梯度的原理,采用对角线方向相邻两像素之差. 小波变换的方法比较适用于展现夹带在正常信号中的瞬间反常现象,具有方向敏感性.所以可以边缘检 ...

  3. MATLAB批量打印输出600PPI的图像且图像不留空白

    一 前言 最近收到审稿人的修改意见,其中有三条:一条为<RC: There were only five images evaluated in the experiment, and I re ...

  4. DPM总结

    DPM:Deformable Parts Model(来自http://www.cs.berkeley.edu/~rbg/latent/index.html) 目标检测算法 先计算梯度方向直方图,在用 ...

  5. 快速傅里叶变换(FFT)

    一.FFT的意义 DFT虽然实现了FT的计算机计算,但是计算量大,不适合实时的数字信号处理.FFT算法的出现,使DFT的计算效率更高,速度更快. 二.FFT与DFT的关系 从FT到DFT经过了数字角频 ...

  6. 离散傅里叶变换(DFT)

    目录     一.研究的意义     二.DFT的定义    三.DFT与傅里叶变换和Z变换的关系     四.DFT的周期性     五.matlab实验       五.1 程序         ...

  7. matlab---边缘之sobel简单实例

    最近在项目中需要做一些图像边缘检测的工作,但是由于之前没接触过图像处理的相关知识,所以只得 在matlab里面对一些图像处理函数挨个挨个的试着用.在用的过程中在慢慢的明白了一些简单的图像处 理方法. ...

  8. 论文阅读 | A Curriculum Domain Adaptation Approach to the Semantic Segmentation of Urban Scenes

    paper链接:https://arxiv.org/pdf/1812.09953.pdf code链接:https://github.com/YangZhang4065/AdaptationSeg 摘 ...

  9. zouxy09-图像卷积与滤波的一些知识点

    原文地址 图像卷积与滤波的一些知识点 zouxy09@qq.com http://blog.csdn.net/zouxy09 之前在学习CNN的时候,有对卷积进行一些学习和整理,后来就烂尾了,现在稍微 ...

随机推荐

  1. PHP全路径无限分类原理

    全路径无限分类:以一个字段把他所有的父级id按顺序记录下来以此实现的无限分类叫做全路径无限分类 优点:查询方便 缺点:增加,移动分类时数据维护时稍微复杂.

  2. js截图及绕过服务器图片保存至本地(html2canvas)

    今天要分享的是用html2canvas根据自己的需求生成截图,并且修复html2canvas截图模糊,以及绕过服务器图片保存至本地. 只需要短短的几行代码,就能根据所需的dom截图,是不是很方便,但是 ...

  3. html 获取数据并发送给后端方式

    一.方式一 使用ajax提交 function detailed() { var date = $("#asset_ip").text() $.ajax({ url: " ...

  4. OSGI企业应用开发(十五)基于Spring、Mybatis、Spring MVC实现一个登录应用

    前面文章中,我们已经完成了OSGI应用中Spring.Mybatis.Spring MVC的整合,本篇文章我们就在这个基础上来完成一个简单的登录应用,其中用户名和密码需要从数据库中查询. 前面文章中, ...

  5. win10怎么录制电脑屏幕 电脑播放视频录制

    随着社会的发展,网络信息化时代已经来临,作为一个上班族,每天都离不开电脑,电脑仿佛就是我们的合作伙伴,也是陪伴我们的朋友,如今win10系统已经出来了,关于win10系统的问题相信大家有很多的问题,今 ...

  6. View体系之属性动画

    (内容省略了valueAnimator和PropertyValueHolder使用) 属性动画的使用的主要方式是AnimatorSet和ObjectAnimator配合使用.ObjectAnimato ...

  7. springboot部分常用注解

    目录:[持续更新.....] spring 部分常用注解 spring boot 学习之路1(简单入门) spring boot 学习之路2(注解介绍) spring boot 学习之路3( 集成my ...

  8. (后端)mybatis 模糊查询 mapper.xml的写法(转)

    原文地址:https://blog.csdn.net/sc6231565/article/details/46412765 1. sql中字符串拼接 SELECT * FROM tableName W ...

  9. 使用Visual Studio Team Services持续集成(二)——为构建定义属性

    使用Visual Studio Team Services持续集成(二)--为构建定义属性 1.从VSTS帐户进入到Build 2.编辑构建定义并单击Options Description:如果这里明 ...

  10. Spark操作HBase报:org.apache.hadoop.hbase.client.RetriesExhaustedWithDetailsException异常解决方案

    一.异常信息 19/03/21 15:01:52 WARN scheduler.TaskSetManager: Lost task 4.0 in stage 21.0 (TID 14640, hnte ...