diff --git a/+bids/File.m b/+bids/File.m index 223e086c..8bae6e34 100644 --- a/+bids/File.m +++ b/+bids/File.m @@ -209,7 +209,11 @@ obj.path = args.Results.input; end f_struct = bids.internal.parse_filename(args.Results.input); - obj.modality = obj.get_modality(f_struct.entities); + + obj.modality = ''; + if isfield(f_struct, 'entities') + obj.modality = obj.get_modality(f_struct.entities); + end elseif isstruct(args.Results.input) f_struct = args.Results.input; end diff --git a/tests/test_bids_file.m b/tests/test_bids_file.m index 7e57b5a0..72a91147 100644 --- a/tests/test_bids_file.m +++ b/tests/test_bids_file.m @@ -24,6 +24,12 @@ end +function test_no_entity + + bf = bids.File(fullfile(pwd, 'con_0001.niii')); + +end + function test_participants pth_bids_example = get_test_data_dir();