bbci / bbci_public

MATLAB toolbox for Brain-Computer Interfacing (BCI)
MIT License
149 stars 104 forks source link

misc_history crashes when using proc_appendCnt with cell array input #148

Closed BenjaminBlankertz closed 8 years ago

BenjaminBlankertz commented 8 years ago

misc_history crashes when using proc_appendCnt (or proc_appendEpo) with cell array input, since it assumes the first argument to be a struct, not a cell of structs.

eeg_file= fullfile(BTB.DataDir, 'demoMat', ... 'VPkg_08_08_07', 'calibration_motorimageryVPkg'); [cnt, mrk, mnt] = file_loadMatlab(eeg_file);
[cnt_all, mrk_all]= proc_appendCnt({cnt, cnt, cnt}, {mrk, mrk, mrk});

How should this case be handled? Checking that all cnt's have the same 'history' field?

DanielMiklody commented 8 years ago

Claimed! I would change proc_appendCnt rather then misc_history.. I would simply check them sequentially. Is that what you mean? Or do you really want to check if they have exactly the same history field? I would simply change cnt = misc_history(cnt); to

if iscell(cnt)
    cnt=cellfun(@misc_history,cnt,'UniformOutput',0);
else 
    cnt = misc_history(cnt);
end