How to make matrix dimensions the same size?
이전 댓글 표시
I have data which currently is a fixation report. This means it has starting fixations (SF) and end fixations (EF). For example, in one row the fixation has an SF of 7 and an EF of 50. So one row is 1 fixation with the start and end time.
I want to turn this data into one row per milisecond (in my case there is 39500msec so 39500 rows). With a 1 if there is currently a fixation and 0 if there isnt. With this per participant (PPT).
I have tried to following but get the error message that 'Matrix dimensions must agree'.
I am new to Matlab!
data = readtable('data.txt','HeaderLines',1,'Delimiter','\t');
PPT=data.Var1;
clip=data.Var2;
condition=data.Var3;
SF=data.Var4;
EF=data.Var4;
OnSpeaker=data.Var6;
UP = unique(PPT);
jj=1:39500;
timeMsec=transpose(jj);
for x=1:length(UP) %loop through all the unique participants
for z=1:length(OnSpeaker) %loop through the length of the data
timeseries=zeros(39500,1);
end
for f = 1:length(SF);
if SF>= timeMsec & EF<=timeMsec % This is definitely the bit thats wrong!!
timeseries=1;
else timeseries=0,
end
end
댓글 수: 3
Walter Roberson
2020년 7월 23일
Please give an example of some lines in the text file.
Jessica Dawson
2020년 7월 23일
Jessica Dawson
2020년 7월 23일
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!