Hello,
I have been trying to get my feet wet with scripting for brainstorm. The first step in my pipeline (after importing raw data and manually editing registration) is to import events (of two types) from a pair of .mat files. I did this for one raw file, and saved the script. I then simply changed the filenames for the next (identical) dataset and tried using the script file:
% Input files
FileNamesA = {‘MTRS/@rawMTRS_SD_02_raw/data_0raw_MTRS_SD_02_raw.mat’};
% Start a new report
bst_report(‘Start’, FileNamesA);
sFiles = bst_process(‘CallProcess’, ‘process_evt_import’, FileNamesA, [], …
‘evtfile’, {’/Volumes/PHD/Pilot/MTRS/MEG/EMG/MTRS_SD_02_emg_left_hand.mat’, ‘ARRAY-SAMPLES’});
sFiles = bst_process(‘CallProcess’, ‘process_evt_import’, sFiles, [], …
‘evtfile’, {’/Volumes/PHD/Pilot/MTRS/MEG/EMG/MTRS_SD_02_emg_right_hand.mat’, ‘ARRAY-SAMPLES’});
% Save and display report
ReportFile = bst_report(‘Save’, sFiles);
bst_report(‘Open’, ReportFile);
I tried running this form command line ('matlab -nodesktop -nosplash -r “new_script, exit” '), and got errors:
Reference to non-existent field ‘Program’.
Error in bst_progress (line 59)
if ~isempty(GlobalData) && ~isempty(GlobalData.Program)
Error in bst_error (line 130)
bst_progress(‘stop’);
Error in bst_call (line 31)
bst_error();
Error in macro_methodcall (line 39)
bst_call(str2func(varargin{1}), varargin{2:end});
Error in bst_report (line 53)
macro_methodcall;
Error in script_import_events (line 8 )
bst_report(‘Start’, FileNamesA);
If I comment out the report generation, I still get errors:
** Error: Line 1848: Attempt to reference field of non-structure array.
**
** Call stack:
** >panel_process_select.m>GetProcess at 1848
** >bst_call.m at 26
** >macro_methodcall.m at 37
** >panel_process_select.m at 29
** >bst_process.m>CallProcess at 1051
** >bst_call.m at 26
** >macro_methodcall.m at 37
** >bst_process.m at 30
** >script_import_events.m at 9
**
** Error: Line 1053: bst_process>CallProcess (line 1053)
** Unknown process.
**
** Call stack:
** >bst_process.m>CallProcess at 1053
** >bst_call.m at 26
** >macro_methodcall.m at 37
** >bst_process.m at 30
** >script_import_events.m at 9
**
Not sure what is going on. Help!