Error using horzcat dimensions
Mostra commenti meno recenti
I'm having issues with my end output. It seems to be due to the id variable.
This is printed when ran;
Error using horzcat
Dimensions of arrays being concatenated are not consistent.
Error in week5analysis (line 30)
output=[id dacc drt];
function [output]=week5analysis(data)
%input should create a directory of one or more files
files=dir(data);
%index k should correspond to the number of files within the directory
for k=1:size(files,1)
%extracting id and converting to corresponding number
id=(files(k).name(4:size(files(k).name,2)));
%loading the files within the directory
temp=load(files(k).name);
%removes the first 10 practice trails in both conditions
temp([1:10,51:60],:)=[];
%condition 1
c1=temp(temp(:,1)==1,:);
%condition 2
c2=temp(temp(:,1)==2,:);
%displays the percentage of correct answers for condition 1
acc1=sum(c1(:,2)==1)/numel(c1(:,2))*100;
%displays the percentage of correct answers for condition 2
acc2=sum(c2(:,2)==1)/numel(c2(:,2))*100;
%mean of reaction time for correct trails in condition 1
c1m=mean(c1(c1(:,2)==1,3));
%mean of reaction time for correct trails in condition 2
c2m=mean(c2(c2(:,2)==1,3));
%difference between each condition for accuracy
dacc=c1(:,2)-c2(:,2);
%difference between each condition for reaction time
drt=c1(:,3)-c2(:,3);
%saves difference scores alongside id
output=[id dacc drt];
end
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su LaTeX in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!