Error using fieldnames. Invalid argument of type 'cell'. Input must be a structure or a Java or COM object.
13 views (last 30 days)
Show older comments
Hi,
I am trying to open a BIDS format folder in lead dbs developer mode.
I am getting this error :
"
Error using fieldnames
Invalid input argument of type 'cell'. Input must be a structure or a Java or COM object.
Error in BIDSFetcher/getPreopAnat (line 300)
templateOrder = fieldnames(obj.spacedef.norm_mapping)';
"
These are the parts of the code in the same file "BIDSFetcher.m" where it refers to obj.spacedef.name:
% Set base dir and base name
templateSpace = obj.spacedef.name;
baseName = fullfile(LeadDBSDirs.normDir, 'transformations', ['sub-', subjId, '_from-']);
"
and
% Set normalized anat images
templateSpace = obj.spacedef.name;
session = fieldnames(coregAnat);
for i=1:length(session)
modality = fieldnames(coregAnat.(session{i}));
for j=1:length(modality)
anat = strrep(coregAnat.(session{i}).(modality{j}), LeadDBSDirs.coregDir, LeadDBSDirs.normDir);
normAnat.(session{i}).(modality{j}) = strrep(anat, obj.anchorSpace, templateSpace);
Is it possible to make obj.spacedef.name a structure somehow?
I DO have R2021b installed, however my PhD supervisor also has R2021b installed and does not have the same error. He does have a lot more matlab applications installed than me, and it would be very difficult to find out which app is responsbile for the differene between our machines, considering he has so many that I do not.
Do you have any ideas on a fix for this?
Thanks
Answers (1)
Walter Roberson
on 16 Mar 2023
If you look near line 240 of https://github.com/netstim/leaddbs/blob/master/ea_normalize_ants.m you will see that the code assumes that spacedef.norm_mapping is a cell. Code should not be trying to take fieldnames of it.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!