I have 6 .abf
files which each have the dimension 150000 by 2 by x
where x varies from 1 to 10
. The x
represents trials of a recording. So I have to process these 6 files in MATLAB which I do by a loop that goes over each of the files and does the subsequent processing for each of them. But for each of the trials, even if 10 of them are recorded, not all 10 have the desired data and I need to exclude few and include few trials from each of the file. For example, from the first file, I need trials 1 to 4 for processing while in the second file I need trials 1 to 6 for processing. How can I do this? Is there a way where I can make a list in the beginning to specify the trials for each of the file?
Asked
Active
Viewed 91 times
0

Autonomous
- 8,935
- 1
- 38
- 77

Maddy
- 363
- 3
- 6
- 16
1 Answers
1
Here's a really simple way to do this. If you have just 6 files, you can define trials to include at the top of your function.
% Specify list of trials to include
dataFiles(1).name = 'file1.abf';
dataFiles(1).includedTrials=[1:4];
dataFiles(2).name = 'file2.abf';
dataFiles(2).includedTrials=[1:6];
% iterate over data files
for n = 1:nFiles
% Load data
data = load(datafiles(2).name);
% Select data of trials based on your list
data = data(:,:,dataFiles(n).includedTrials);
% Do processing
end

klurie
- 1,060
- 8
- 16
-
Thanks. I couldn't use it as it is, but helped me write a code suitable for my data type :) – Maddy Mar 10 '13 at 06:05