0

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?

4

1 回答 1

1

这是一个非常简单的方法来做到这一点。如果您只有 6 个文件,您可以定义试验以包含在函数的顶部。

% 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
于 2013-03-07T09:49:00.707 回答