Page 1 of 1

pop_loadBCI2000.m error when passing cell array of filenames

Posted: 02 Dec 2012, 21:55
by boulay
Using revision 0.31 (latest as of today according to SVN).
I tried e-mailing Clemens Brunner directly but the mail bounced back.

Dear Clemens Brunner,

I am using Revision 0.31 of pop_loadBCI2000.m and ran into an error when passing in a cell array of filenames as the first argument. The error was:

Code: Select all

Undefined function or variable "totalSamples".

Error in pop_loadBCI2000 (line 122)
            fileBorders(k) = fileBorders(k - 1) + totalSamples(k - 1);  end
So I edited from line 106 as follows:

Code: Select all

    if iscell(fileName)  % Multiple file names in a cell array
        files = cell2struct(fileName, 'name', 1);
    else  % Just a string (possibly containing wildcards)
        files = dir(fileName);
        for k = 1:length(files)
            files(k).name = fullfile(fileparts(fileName), files(k).name);  % Add full path to each file name
    totalSamples = zeros(1, length(files));
    for k = 1:length(files)
        [~, ~, ~, totalSamples(k)] = load_bcidat(files(k).name, [0, 0]);  % Get length of each individual file
If there's a better way to report a bug then let me know.