How can I run a code for multiple rows which I found from another variable?
Afficher commentaires plus anciens
I want to find out the total time of a participant not watching a video. I have managed to get all the data that I need for one video of a participant:
Start_End = [StartVideo EndVideo];
% Add time of unclassified values to see how much time the participant did not look
Unclassified = find(ismember(AllData.GazeEventType(RowIdx_Participant,:),'Unclassified','rows'));% Find unclassified rows for this participant
Unclassified_1 = intersect((StartVideo(1):EndVideo(1)),Unclassified); %Find unclassified rows in first movie
UnclassifiedFirstVideo = AllData.RecordingTimestamp(Unclassified_1); %Find timestamp of unclassified rows in first movie
TimeUnclassifiedFirstVideo = UnclassifiedFirstVideo(end)-UnclassifiedFirstVideo(1); %Total time not watching first movie
% Subtract endtime from begintime to see how much time is passed in one trial
TimeFirstVideo = AllData.RecordingTimestamp(EndVideo(1)-StartVideo(1));
TotalWatchingTime = TimeFirstVideo-TimeUnclassifiedFirstVideo ; %Total watching time
But I don't know how to do this for all videos (20 in total). I know the rows:

So, what I want in the end is the following, but than in simple code rather than writing out 20 lines:
Unclassified_1 = intersect((StartVideo(1):EndVideo(1)),Unclassified); / Unclassified_1 = intersect(1924:2279),Unclassified);
Unclassified_1 = intersect((StartVideo(2):EndVideo(2)),Unclassified); / Unclassified_1 = intersect(2428:2786),Unclassified);
Unclassified_1 = intersect((StartVideo(3):EndVideo(3)),Unclassified); / Unclassified_1 = intersect(2935:3293),Unclassified); etc.
Can you help me? Thanks!
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur External Language Interfaces dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!