[Line 17] inp= 2^[0:7];
causes Matlab error:
Error using ^
Inputs must be a scalar and a square matrix.
To compute elementwise POWER, use POWER (.^) instead.
Solution: change to
inp= 2.^(0:7);
[Line 47] bbci_apply_acquireData(data.source, bbci.source, data.marker);
causes Matlab error:
Undefined variable "data" or class "data.source".
Problem: "data" is a return value of "bbci_apply_initData(bbci)". However, the buggy line is inside an auxiliary function "acq_checkTrigger(bbci, inp, timeout)".
Solution: change the following lines:
[Line 21] outp{k}= acq_checkTrigger(bbci, inp(k), 500);
[Line 40] function outp= acq_checkTrigger(bbci, inp, timeout)
to:
outp{k}= acq_checkTrigger(bbci, data, inp(k), 500);
function outp= acq_checkTrigger(bbci, data, inp, timeout)
[Line 53] bbci_apply_close(bbci);
causes Matlab error:
Error using bbci_acquire_bv
bbci_acquire_bv: open a connection first!
Error in bbci_apply_acquireData (line 35)
[new_data, mrkTime, mrkDesc, source.state] = ...
Error in acq_checkTriggers>acq_checkTrigger (line 47)
[source, marker]= ...
Error in acq_checkTriggers (line 22)
outp{k}= acq_checkTrigger(bbci, data, 500);
Problem: bbci_apply_close should not be called in the auxiliary function "acq_checkTrigger", as this will close the connection before the next iteration can begin, see [Line 21].
Solution: Move the mentioned line to the bottom of acq_checkTriggers. This will close the connection after the whole function is finished.
[Line 21] outp{k}= acq_checkTrigger(bbci, inp(k), 500);
causes Matlab warning (not error):
The variable 'outp' appears to change size on every loop operation. [...]
Solution: insert the following line [before line 19]:
outp=cell(1:8);
[Line 40] function outp= acq_checkTrigger(bbci, inp, timeout)
receives a variable "inp", which is one of the values [1 2 4 8 16 32 64 128]. However, this value is unused.
[Lines 27-29] if ~isequal(inp(k), outp{k}), trigger_ok= 0; end [Lines end]
compares the value of inp(k) with the return value of acq_checkTrigger. If they are unequal a single time, trigger_ok is set to 0.
[Lines 32-36]
if trigger_ok, fprintf('Trigger test successful.\n');
else error('!!! Trigger test unsuccessful !!!\n'); end [Lines end]
will therefore always trigger an error.
I have no solution, since I do not understand what "triggers are operational" (documentation) means and how this can be determined by the code of acq_checkTriggers.