cpp-lln-lab / CPP_PTB

a set of function to make it easier to create behavioral, EEG, fMRI experiment with psychtoolbox
https://cpp-ptb.readthedocs.io/en/latest/index.html#
MIT License
14 stars 13 forks source link

CPP_waitForTriggerDemo crashes #47

Closed CerenB closed 4 years ago

CerenB commented 4 years ago

CPP_waitForTriggerDemo.m crashes, please see below:

>> waitForTrigger(cfg);
Will wait for triggers on the main keyboard device.
Waiting for trigger 
 Trigger 1 
Reference to non-existent field 'MRI'.

Error in waitForTrigger>pauseBetweenTriggers (line 74)
    if ~isempty(cfg.MRI.repetitionTime)

Error in waitForTrigger (line 46)
                    pauseBetweenTriggers(cfg);
CerenB commented 4 years ago

in CPP_getResponseDemo.m

I'm using macbook pro, touchbar has esc key and when i try esc as key press, I got this error:

Reference to non-existent field 'pressed'.

Error in CPP_getResponseDemo (line 99)
        if responseEvents(iEvent).pressed

maybe @marcobarilari can try and replicate the error in his laptop?

Note: in CPP_checkAbortDemo.m the esc key works, I receive the following:

>> CPP_checkAbortDemo
Warning: You pressed the escape key: will try to fail gracefully. 
> In CPP_checkAbortDemo (line 24) 

We did catch your abort signal.
Remi-Gau commented 4 years ago

OK I defo need to remember to run the demos and not just the test.

CerenB commented 4 years ago

@Remi-Gau where do you set cfg.MRI field? waitForTrigger.m crashes due to non-existing cfg.MRI.repetitionTime

Oh... I think you are setting up in createFilename.m and/or in checkCFG.m to expParam.MRI and not cfg.MRI, thus it does crash...

CerenB commented 4 years ago

as a side note, when do the change from expParam to cfg be careful with such:

if nargin < 2
        cfg = struct();
    end

They empty your cfg which contains everything.

marcobarilari commented 4 years ago

in CPP_getResponseDemo.m

I'm using macbook pro, touchbar has esc key and when i try esc as key press, I got this error:

Reference to non-existent field 'pressed'.

Error in CPP_getResponseDemo (line 99)
        if responseEvents(iEvent).pressed

maybe @marcobarilari can try and replicate the error in his laptop?

Note: in CPP_checkAbortDemo.m the esc key works, I receive the following:

>> CPP_checkAbortDemo
Warning: You pressed the escape key: will try to fail gracefully. 
> In CPP_checkAbortDemo (line 24) 

We did catch your abort signal.

yep, same error, I guess the problem is that in getResponse we have errorAbortGetReponse(responseEvents); while the function itself is

function errorAbortGetReponse

    errorStruct.message = 'Escape key press detected by getResponse: aborting experiment.';
    errorStruct.identifier = 'getResponse:abortRequested';

    error(errorStruct);
end
CerenB commented 4 years ago

oh! that's easy to fix then :)

marcobarilari commented 4 years ago

@Ceren and @Remi-Gau I think that both the demos mentioned in this issue are working (I say it because I try) so I am going to close this one.

Reopen it if you test them and they fail.