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. react学习(四)之设置 css样式 篇

    react中设置css样式 方法一: 行内样式:使用{{  }},与正常jsx中插入js代码不一样,这里需要两个括号. <div style={ { float: 'right',} }> ...

  2. idea编辑器快捷键调整

    习惯了Eclipse中的删除快捷键,idea中的快捷键用着不是很适应,于是乎调整了下. idea编辑器快捷键调整: 默认:删除代码行:Ctrl+Y复制代码行:Ctrl+D在当前行之前添加一行: Ctr ...

  3. FUNCTIONALITY OF ITEM CATEGORY

    Item Category Purpose This wiki page will breify discuss about functionality of Item Category in SAP ...

  4. 性能测试 CentOS下结合InfluxDB及Grafana图表实时展示JMeter相关性能数据

    CentOS下结合InfluxDB及Grafana图表实时展示JMeter相关性能数据   by:授客 QQ:1033553122 实现功能 1 测试环境 1 环境搭建 2 1.安装influxdb ...

  5. 基于Python实现的死链接自动化检测工具

    基于Python实现的死链接自动化检测工具   by:授客 QQ:1033553122 测试环境: win7 python 3.3.2 chardet 2.3.0 脚本作用: 检测系统中访问异常(请求 ...

  6. Android为TV端助力 android 在5.0以后不允许使用隐式Intent方式来启动Service

    android5.0以后不能使用隐式intent :需要指定Intent的ComponentName信息:intent.setComponent(xxx),或指定Intent的setPackage(& ...

  7. [TensorFlow]Tensor维度理解

    http://wossoneri.github.io/2017/11/15/[Tensorflow]The-dimension-of-Tensor/ Tensor维度理解 Tensor在Tensorf ...

  8. 软件工程:java实现wc项目基本功能

    项目相关要求 项目地址:https://github.com/xiawork/wcwork 实现一个统计程序,它能正确统计程序文件中的字符数.单词数.行数,以及还具备其他扩展功能,并能够快速地处理多个 ...

  9. 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 ...

  10. html留言功能

    <!DOCTYPE html> <html lang="zh"> <head> <meta charset="UTF-8&quo ...