% ------------------------------
% Matlab csv數(shù)據(jù)批量預(yù)處理輸出至Excel
% 時(shí)間:2022年8月28日
% 所需軟件代碼:Matlab R2020a
% 本代碼版本:3.00
% 程序員:wishing
% ------------------------------
%% 初始化
% 清理運(yùn)行環(huán)境
clearvars
clc
%% 單個(gè)文件處理
%% 目標(biāo):
% 1.篩選出每個(gè)被試4種速度條件下的數(shù)據(jù)(無(wú)應(yīng)答率还惠,正確率泞莉,反應(yīng)時(shí),最快10%平均反應(yīng)時(shí)),需計(jì)算出結(jié)果寞秃,最終每個(gè)被試有四中速度下的結(jié)果瑰枫,每種速度下有四個(gè)值踱葛。
% 2.整理成RW狀態(tài)下speed1(+-0.5)/speed2(+-1)/speed3(+-1.5)/speed4(+-2)下的所有被試的數(shù)據(jù)。(RW下四個(gè)Sheet,SD下四個(gè)sheet光坝,每個(gè)sheet下每個(gè)被試有四個(gè)值)
%% 循環(huán)處理
for No = 10 : 37
filename_RW = string(append('D:\desk\speed\data_1\behavior\RW','\','1',string(No),'.csv'));%文件位置尸诽,制作NO循環(huán)
filename_SD = string(append('D:\desk\speed\data_1\behavior\SD','\','2',string(No),'.csv'));%文件位置,制作NO循環(huán)
%% 數(shù)據(jù)準(zhǔn)備
data_RW = readmatrix(filename_RW); % 導(dǎo)入成矩陣
data_SD = readmatrix(filename_SD);
A = data_RW(:,[2 18 19 20]);%提取2,18,19,20列組成新數(shù)組盯另,分別代表speed性含,res_keys,res_corr,res_rt
B = data_SD(:,[2 18 19 20]);
R_speed_1 = A(A(:,1)==7.5|A(:,1)==8.5,:);% 篩選出speed1,2,3,4的數(shù)據(jù)
R_speed_2 = A(A(:,1)==7|A(:,1)==9,:);
R_speed_3 = A(A(:,1)==6.5|A(:,1)==9.5,:);
R_speed_4 = A(A(:,1)==6|A(:,1)==10,:);
S_speed_1 = B(B(:,1)==7.5|B(:,1)==8.5,:);
S_speed_2 = B(B(:,1)==7|B(:,1)==9,:);
S_speed_3 = B(B(:,1)==6.5|B(:,1)==9.5,:);
S_speed_4 = B(B(:,1)==6|B(:,1)==10,:);
%% 計(jì)算指標(biāo)
%RW
R_speed_1_norate = numel(find(isnan(R_speed_1(:,2))))/14;%計(jì)算無(wú)應(yīng)答率,nan個(gè)數(shù)/14
R_speed_1_corate = sum(R_speed_1(:,3))/14;%計(jì)算正確率鸳惯,1求和/14
R_speed_1_meanrt = mean(R_speed_1(:,4),'omitnan');%計(jì)算均值商蕴,忽略nan
R_speed_1_fastrt = min(R_speed_1(:,4));%最快10%,14個(gè)中就是最小值
R_speed_2_norate = numel(find(isnan(R_speed_2(:,2))))/14;
R_speed_2_corate = sum(R_speed_2(:,3))/14;
R_speed_2_meanrt = mean(R_speed_2(:,4),'omitnan');
R_speed_2_fastrt = min(R_speed_2(:,4));
R_speed_3_norate = numel(find(isnan(R_speed_3(:,2))))/14;
R_speed_3_corate = sum(R_speed_3(:,3))/14;
R_speed_3_meanrt = mean(R_speed_3(:,4),'omitnan');
R_speed_3_fastrt = min(R_speed_3(:,4));
R_speed_4_norate = numel(find(isnan(R_speed_4(:,2))))/14;
R_speed_4_corate = sum(R_speed_4(:,3))/14;
R_speed_4_meanrt = mean(R_speed_4(:,4),'omitnan');
R_speed_4_fastrt = min(R_speed_4(:,4));
%SD
S_speed_1_norate = numel(find(isnan(S_speed_1(:,2))))/14;
S_speed_1_corate = sum(S_speed_1(:,3))/14;
S_speed_1_meanrt = mean(S_speed_1(:,4),'omitnan');
S_speed_1_fastrt = min(S_speed_1(:,4));
S_speed_2_norate = numel(find(isnan(S_speed_2(:,2))))/14;
S_speed_2_corate = sum(S_speed_2(:,3))/14;
S_speed_2_meanrt = mean(S_speed_2(:,4),'omitnan');
S_speed_2_fastrt = min(S_speed_2(:,4));
S_speed_3_norate = numel(find(isnan(S_speed_3(:,2))))/14;
S_speed_3_corate = sum(S_speed_3(:,3))/14;
S_speed_3_meanrt = mean(S_speed_3(:,4),'omitnan');
S_speed_3_fastrt = min(S_speed_3(:,4));
S_speed_4_norate = numel(find(isnan(S_speed_4(:,2))))/14;
S_speed_4_corate = sum(S_speed_4(:,3))/14;
S_speed_4_meanrt = mean(S_speed_4(:,4),'omitnan');
S_speed_4_fastrt = min(S_speed_4(:,4));
%% 輸出結(jié)果
% RW
writematrix([R_speed_1_norate R_speed_1_corate R_speed_1_meanrt R_speed_1_fastrt],'RW_speed.xlsx','sheet',1,'Range',string(append('A',string(No),':D',string(No))));%循環(huán)寫入表格
writematrix([R_speed_2_norate R_speed_2_corate R_speed_2_meanrt R_speed_2_fastrt],'RW_speed.xlsx','sheet',2,'Range',string(append('A',string(No),':D',string(No))));
writematrix([R_speed_3_norate R_speed_3_corate R_speed_3_meanrt R_speed_3_fastrt],'RW_speed.xlsx','sheet',3,'Range',string(append('A',string(No),':D',string(No))));
writematrix([R_speed_4_norate R_speed_4_corate R_speed_4_meanrt R_speed_4_fastrt],'RW_speed.xlsx','sheet',4,'Range',string(append('A',string(No),':D',string(No))));
% SD
writematrix([S_speed_1_norate S_speed_1_corate S_speed_1_meanrt S_speed_1_fastrt],'SD_speed.xlsx','sheet',1,'Range',string(append('A',string(No),':D',string(No))));
writematrix([S_speed_2_norate S_speed_2_corate S_speed_2_meanrt S_speed_2_fastrt],'SD_speed.xlsx','sheet',2,'Range',string(append('A',string(No),':D',string(No))));
writematrix([S_speed_3_norate S_speed_3_corate S_speed_3_meanrt S_speed_3_fastrt],'SD_speed.xlsx','sheet',3,'Range',string(append('A',string(No),':D',string(No))));
writematrix([S_speed_4_norate S_speed_4_corate S_speed_4_meanrt S_speed_4_fastrt],'SD_speed.xlsx','sheet',4,'Range',string(append('A',string(No),':D',string(No))));
end
csv數(shù)據(jù)matlab批處理
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
- 文/潘曉璐 我一進(jìn)店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來(lái)雾叭,“玉大人悟耘,你說(shuō)我怎么就攤上這事≈” “怎么了暂幼?”我有些...
- 文/不壞的土叔 我叫張陵,是天一觀的道長(zhǎng)移迫。 經(jīng)常有香客問(wèn)我旺嬉,道長(zhǎng),這世上最難降的妖魔是什么厨埋? 我笑而不...
- 正文 為了忘掉前任邪媳,我火速辦了婚禮,結(jié)果婚禮上荡陷,老公的妹妹穿的比我還像新娘雨效。我一直安慰自己,他們只是感情好废赞,可當(dāng)我...
- 文/花漫 我一把揭開白布徽龟。 她就那樣靜靜地躺著,像睡著了一般唉地。 火紅的嫁衣襯著肌膚如雪据悔。 梳的紋絲不亂的頭發(fā)上,一...
- 那天耘沼,我揣著相機(jī)與錄音极颓,去河邊找鬼。 笑死群嗤,一個(gè)胖子當(dāng)著我的面吹牛菠隆,可吹牛的內(nèi)容都是我干的。 我是一名探鬼主播狂秘,決...
- 文/蒼蘭香墨 我猛地睜開眼骇径,長(zhǎng)吁一口氣:“原來(lái)是場(chǎng)噩夢(mèng)啊……” “哼!你這毒婦竟也來(lái)了赃绊?” 一聲冷哼從身側(cè)響起既峡,我...
- 序言:老撾萬(wàn)榮一對(duì)情侶失蹤羡榴,失蹤者是張志新(化名)和其女友劉穎碧查,沒(méi)想到半個(gè)月后,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體,經(jīng)...
- 正文 獨(dú)居荒郊野嶺守林人離奇死亡忠售,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
- 正文 我和宋清朗相戀三年传惠,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片稻扬。...
- 正文 年R本政府宣布逝她,位于F島的核電站浇坐,受9級(jí)特大地震影響,放射性物質(zhì)發(fā)生泄漏黔宛。R本人自食惡果不足惜近刘,卻給世界環(huán)境...
- 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望臀晃。 院中可真熱鬧觉渴,春花似錦、人聲如沸徽惋。這莊子的主人今日做“春日...
- 文/蒼蘭香墨 我抬頭看了看天上的太陽(yáng)寂曹。三九已至哎迄,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間隆圆,已是汗流浹背漱挚。 一陣腳步聲響...
- 正文 我出身青樓,卻偏偏與公主長(zhǎng)得像侣背,于是被迫代替她去往敵國(guó)和親白华。 傳聞我的和親對(duì)象是個(gè)殘疾皇子,可洞房花燭夜當(dāng)晚...
推薦閱讀更多精彩內(nèi)容
- 數(shù)據(jù)庫(kù)連接池 連接池介紹 實(shí)際開發(fā)中“獲得連接”或“釋放資源”是非常消耗系統(tǒng)資源的兩個(gè)過(guò)程,為了解決此類性能問(wèn)題更鲁,...
- 數(shù)據(jù)統(tǒng)計(jì)分析系統(tǒng)開發(fā)視頻教程(離線處理-流處理-批處理) 課程學(xué)習(xí)地址:http://www.xuetuwuyou...
- 大型企業(yè)級(jí)云產(chǎn)品-億級(jí)數(shù)據(jù)統(tǒng)計(jì)分析系統(tǒng)(離線處理-流處理-批處理) 課程詳情:http://www.xuetuwu...
- 版權(quán)聲明:本文為作者原創(chuàng)書籍。轉(zhuǎn)載請(qǐng)注明作者和出處媒至,未經(jīng)授權(quán)顶别,嚴(yán)禁私自轉(zhuǎn)載,侵權(quán)必究>軉=钕摹! 情感語(yǔ)錄: 生活本來(lái)就...
- 一次寫入,多次批量讀取 批處理層主數(shù)據(jù)集存儲(chǔ)的需求代碼清單 寫: 高效追加新數(shù)據(jù) 可擴(kuò)展的存儲(chǔ) 讀: 支持并行處理...