BST Team,
I am having a frustratingly difficult time adding 61 subjects with continuous EEG in a .mat format to my protocol. I have attempted many different routes, and thought that I found success with code below as everything ran smoothly. However, when I click the "Link to raw file" for each subject, I receive an error stating that the file was not found. While looking in the individual subject directories, the file exists but is 5KB... Yet, there is a .bst that is the correct size of the file (i.e. 550,000 KB). Each iteration of the script generates "BST> File converted to binary .bst format: 'Filename.bst'", and clearly this has some impact on the nonexistence of the corresponding .mat file within the subject data folder.
Thoughts on what is happening?
Would moving the actual file into this folder with the corresponding name resolve the issue?
Any assistance is greatly appreciated.
CODE
% SubjectNames is a 1x61 cell with all 61 subjects names %
for sub = 1:length(SubjectNames)
SubjectName = char(SubjectNames{sub});
% Condition will be the 'Group' that each subject corresponds to based
% on previously existing indexing %
if ismember(sub, Participants.N2N3Cycle1SourceEEG.UpdatedIndex.IHwoNC)
Condition = 'IHwoNC';
end
if ismember(sub, Participants.N2N3Cycle1SourceEEG.UpdatedIndex.MDDHYP)
Condition = 'MDDHYP';
end
if ismember(sub, Participants.N2N3Cycle1SourceEEG.UpdatedIndex.HC)
Condition = 'HC';
end
% FLT_OnlyGoodEpochs_ForBST is a location that was previously defined
% and houses the continuous, raw .mat files
RawFile = [FLT_OnlyGoodEpochs_ForBST_Loc SubjectName '_FLT_Cyc1N2N3_AvgRef_OnlyGoodEpochs.mat'];
% Exporting File to BST %
sFiles = [];
sFiles = bst_process('CallProcess', 'process_import_data_raw', sFiles, [], ...
'subjectname', SubjectName, ...
'condition', Condition, ...
'datafile', {RawFile, 'EEG-MAT'}, ...
'channelreplace', 1, ...
'channelalign', 1, ...
'evtmode', 'value');
ReportFile = bst_report('Save', sFiles);
clear RawFile
end
ERROR
Warning: File not found:
F:\Hypersomnia_N2N3Cycle1_SourceLocalization\OnlyGoodEpochs\Cycle1_N2N3_ForBrainstorm_OnlyGoodEpochs\Brainstorm_MainDirectory\Hypersomnia_SourceEstimation_Cyc1N2N3\data\DP001@rawDP001_FLT_Cyc1N2N3_AvgRef_OnlyGoodEpochs\data_0raw_DP001_FLT_Cyc1N2N3_AvgRef_OnlyGoodEpochs.mat
In file_fullpath (line 68)
In tree_callbacks (line 2008)
In bst_call (line 26)
In panel_protocols>CreatePanel/protocolTreeClicked_Callback (line 139)
Error using in_bst_data (line 43)
Data file was not found:
DP001/@rawDP001_FLT_Cyc1N2N3_AvgRef_OnlyGoodEpochs/data_0raw_DP001_FLT_Cyc1N2N3_AvgRef_OnlyGoodEpochs.mat
Please reload this protocol (right-click > reload).
Error in import_raw_to_db (line 40)
DataMat = in_bst_data(DataFile);
Error in tree_callbacks>@(h,ev)import_raw_to_db(filenameRelative) (line 1148)
gui_component('MenuItem', jPopup, , 'Import in
database', IconLoader.ICON_EEG_NEW, ,
@(h,ev)import_raw_to_db(filenameRelative));