stroop效应matlab实验
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实验的更多相关文章
- FFT的分析以及matlab实验
FFT(Fast Fourier Transformation),即为快速傅氏变换,是离散傅氏变换(DFT)的快速算法. 采样得到的数字信号,做FFT变换,N个采样点,经过FFT之后,就可以得到N个点 ...
- 边缘检测算子和小波变换提取图像边缘【matlab】
Roberts边缘检测算子:根据一对互相垂直方向上的差分可用来计算梯度的原理,采用对角线方向相邻两像素之差. 小波变换的方法比较适用于展现夹带在正常信号中的瞬间反常现象,具有方向敏感性.所以可以边缘检 ...
- MATLAB批量打印输出600PPI的图像且图像不留空白
一 前言 最近收到审稿人的修改意见,其中有三条:一条为<RC: There were only five images evaluated in the experiment, and I re ...
- DPM总结
DPM:Deformable Parts Model(来自http://www.cs.berkeley.edu/~rbg/latent/index.html) 目标检测算法 先计算梯度方向直方图,在用 ...
- 快速傅里叶变换(FFT)
一.FFT的意义 DFT虽然实现了FT的计算机计算,但是计算量大,不适合实时的数字信号处理.FFT算法的出现,使DFT的计算效率更高,速度更快. 二.FFT与DFT的关系 从FT到DFT经过了数字角频 ...
- 离散傅里叶变换(DFT)
目录 一.研究的意义 二.DFT的定义 三.DFT与傅里叶变换和Z变换的关系 四.DFT的周期性 五.matlab实验 五.1 程序 ...
- matlab---边缘之sobel简单实例
最近在项目中需要做一些图像边缘检测的工作,但是由于之前没接触过图像处理的相关知识,所以只得 在matlab里面对一些图像处理函数挨个挨个的试着用.在用的过程中在慢慢的明白了一些简单的图像处 理方法. ...
- 论文阅读 | 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 摘 ...
- zouxy09-图像卷积与滤波的一些知识点
原文地址 图像卷积与滤波的一些知识点 zouxy09@qq.com http://blog.csdn.net/zouxy09 之前在学习CNN的时候,有对卷积进行一些学习和整理,后来就烂尾了,现在稍微 ...
随机推荐
- 我为什么推荐Prettier来统一代码风格
译者按: 关于代码风格,不同的人有不同的偏好,其实并没有什么绝对的对错.但是,有2条原则应该是对的: 少数服从多数:用工具统一风格. 原文: Why robots should format our ...
- JS使用cookie实现只出现一次的广告代码效果
我们上网经常会遇到第一次需要登录而之后不用再登录的网站的情况,其实是运用了Cookie 存储 web 页面的用户信息,Cookie 以名/值对形式存储,当浏览器从服务器上请求 web 页面时, 属于该 ...
- Go开发之路 -- strings以及strconv的使用
strings的使用 HasPrefix 语法: strings.HasPrefix(s, prefix string) bool // 判断字符串s是否以prefix开头 // 判断一个url是否以 ...
- es6 语法 (数组扩展)
{ let arr = Array.of(3, 4, 7, 9, 11); console.log('arr', arr); //[3,4,7,9,11] let empty = Array.of() ...
- SPOJ7258 SUBLEX - Lexicographical Substring Search(后缀自动机)
Little Daniel loves to play with strings! He always finds different ways to have fun with strings! K ...
- 洛谷P1333 瑞瑞的木棍(欧拉回路)
题目描述 瑞瑞有一堆的玩具木棍,每根木棍的两端分别被染上了某种颜色,现在他突然有了一个想法,想要把这些木棍连在一起拼成一条线,并且使得木棍与木棍相接触的两端颜色都是相同的,给出每根木棍两端的颜色,请问 ...
- MMU学习总结
待完善 一.MMU主要完成哪些事务? 二.PowerPC上的BAT.LAW是做什么用的? 三.
- [Python][小知识][NO.3] Python 使用系统默认浏览器打开指定URL的网址
1.前言 一般用到的地方: GUI交互界面下,单击某个按钮实现打开指定网址. 某帮助菜单项目,需要跳转网页显示时. O.O 某XX程序,需要植入网页弹窗广告时... 2.方法 调用 webbrowse ...
- Spark操作parquet文件
package code.parquet import java.net.URI import org.apache.hadoop.conf.Configuration import org.apac ...
- SQL Server OPTION (OPTIMIZE FOR UNKNOWN) 测试总结
关于SQL Server的查询提示OPTION (OPTIMIZE FOR UNKNOWN) ,它是解决参数嗅探的方法之一. 而且对应的SQL语句会缓存,不用每次都重编译.关键在于它的执行计划的准 ...