Data extraction from .csv and .txt files
Show older comments
I have an EEG database with 101 subjects. I have written a script that will automatically point me to the correct raw data files for each subject (there are EEG, Eyetracking, and Behavioural files for each subject) but I need to create some sort of loop so I can cycle through the database and extract data from each file for each subject.
I created a subject database that includes subject ID, and other demographic info about that subject. In addition, I have included columns that have filename information such as "age_range" and "file_prefix" which I will need matlab to reference in order to open the correct file. For each subject, their EEG file has a slightly different prefix but I have recorded all of this in the subject database as "file_prefx" already. All I need to do is point MATLAB to the correct column so it will automatically fill in the correct file name and open the correct file.
I'm only creating a for loop for the subjects so I can open the correct file in the first place right now. Once I've finished that, I will need to use some sort of function that extracts the data I'm interested in and formats it into a table.
The subject database is a .csv file and I have opened it using the function
a=fopen('filename.csv');
b=textscan(a, '%s %s %s %s %s %s %s %s %s', 'delimiter', ',');
Can anyone help me with creating this for loop? I'm new to matlab so I need some help. I've checked the documentation but I'm not quite sure how to open individual files based on a row of the subject database.
Thanks in advance!
Accepted Answer
More Answers (0)
Categories
Find more on EEG/MEG/ECoG 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!