Looping a script over several files

Hi gang,
I'm trying to combine several files of data from an eye tracking experiment into one file. We have two files per condition per participant with three conditions, so a total of 6 files per participant.
The files are in different folders and are named either valuepair_AB001_a or valuepair_AB001_a_fix where AB001 is the participant ID and the a at the end signifies the condition (we have similar files for conditions b and c for each participant).
I wrote a quick script to combine the values I need for one condition from 1 participant, but now I need to loop it over all the other files. I would also like to make it so that each row of data has the participants condition/participant ID on it as well.
I don't have the slightest idea how I would go about doing that, but if anyone can point me in the right direction, it would be very much appreciated.
Thanks for your help and let me know if you need any clarification!

댓글 수: 1

dpb
dpb 2013년 12월 9일
Basically, just use dir for each of the subdirectories and then loop over the returned structures processing each in turn, simply doing a comparison of the subject name to get the correct one for each iteration. Presuming you don't have missing files, the length() of each directory listing should be the same if the structure is as I think I understand you said.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Search Path에 대해 자세히 알아보기

질문:

2013년 12월 9일

댓글:

dpb
2013년 12월 9일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by