注册 登录
中国神经科学论坛 返回首页

thinker的个人空间 https://bbs.bioguider.com/?2 [收藏] [复制] [分享] [RSS]

日志

利用MATLAB进行一个人的”双盲“实验

热度 43已有 2698 次阅读2011-8-25 08:44 |个人分类:软件使用| 命名, 如何, change, video, 一个人

如何一个人也能做”双盲“实验?下面是一段MATLAB代码,可以把视频随机命名,进行统计后再到EXCEL里找出正确的顺序。虽然不是严格意义上的双盲实验,但这样做大大的减少了BIAS的可能。

%randomly change video name for double-blind experiments
clear
clc
pathname = uigetdir; %pick a folder
cd (pathname) % enter the folder
dirData = dir('*.avi'); %list all videos
fileNames = {dirData.name};     %# Create a cell array of file names
videoNum = 1:numel(fileNames); % video number
nameBlind=randsample(numel(fileNames),numel(fileNames)); % randomize video
mkdir(pathname,'blind') % creat a folder to save randomized videos
newNames={};
for iFile = 1:numel(fileNames)  %# Loop over the file names
  newName = sprintf('video%02d.avi',nameBlind(iFile));  %# Make the new name
  newNames (iFile) = {newName}; % save all new names
  copyfile(fileNames{iFile},[pathname, '/blind/',newName]);        %# Rename the file
end
% save new name and old name to excel file
xlswrite('blindcount.xls', {'#Num#' 'Random No.' 'New Video Name' 'Old Video Name'}, 'FindRand','A1')
xlswrite('blindcount.xls', videoNum', 'FindRand','A2')
xlswrite('blindcount.xls', nameBlind, 'FindRand','B2')
xlswrite('blindcount.xls', newNames', 'FindRand','C2')
xlswrite('blindcount.xls', fileNames', 'FindRand','D2')
 已同步至 thinker的微博

路过

雷人

握手

鲜花

鸡蛋

评论 (0 个评论)

facelist doodle 涂鸦板

您需要登录后才可以评论 登录 | 注册

小黑屋|手机版|Archiver|生物行[生物导航网] ( 沪ICP备05001519号 )

GMT+8, 2024-4-24 17:45 , Processed in 0.063149 second(s), 18 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

返回顶部