How to make matrix dimensions the same size?
Show older comments
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 Comments
Walter Roberson
on 23 Jul 2020
Please give an example of some lines in the text file.
Jessica Dawson
on 23 Jul 2020
Jessica Dawson
on 23 Jul 2020
Accepted Answer
More Answers (0)
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!