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 で Matrix Indexing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!