MATLAB Answers

Insufficient number of outputs from right hand side of equal sign to satisfy assignment error in fieldtrip toolbox

8 views (last 30 days)
Mahmoud Trabulsi
Mahmoud Trabulsi on 13 Apr 2020
Edited: Daniel M on 24 Apr 2020
I'm trying to run a sample code given found in the examples provided within the toolbox which is:
cfg1 = [];
cfg1.InstitutionName = 'Radboud University';
cfg1.InstitutionalDepartmentName = 'Donders Institute for Brain, Cognition and Behaviour';
cfg1.InstitutionAddress = 'Kapittelweg 29, 6525 EN, Nijmegen, The Netherlands';
% required for dataset_description.json
cfg1.dataset_description.Name = 'EMG example';
cfg1.dataset_description.BIDSVersion = 'unofficial extension';
% optional for dataset_description.json
cfg.dataset_description.License = 'n/a';
cfg.dataset_description.Authors = 'n/a';
cfg.dataset_description.Acknowledgements = 'n/a';
cfg.dataset_description.Funding = 'n/a';
cfg.dataset_description.ReferencesAndLinks = 'n/a';
cfg.dataset_description.DatasetDOI = 'n/a';
cfg1.method = 'copy'; % the original data is in a BIDS-compliant format and can simply be copied
cfg1.bidsroot = './bids'; % write to the present working directory
cfg1.datatype = 'emg';
cfg1.sub = 'NT05';
% these are general fields
cfg1.Manufacturer = 'BrainProducts';
cfg1.ManufacturersModelName = 'BrainAmp MR plus';
% these are EMG specific fields
cfg1.emg.EMGPlacementScheme = 'electrode pairs were placed over various muscles';
cfg1.emg.EMGReference = 'bipolar';
cfg1.emg.EMGGround = 'unclear where the ground electrode was placed on the body';
cfg1.emg.EMGChannelCount = 13; % it might actually be that some channels are recording something else
% there are two recordings of the EMG, during the RS scan and during the GABA scan
% in both EMG recordings the task for the subject was the same
cfg1.TaskDescription = 'The subject was lying in the MRI scanner during a resting-state BOLD scan, while EMG was being recorded';
cfg1.task = 'resting';
cfg1.dataset = './original/nt05_EMG_SESS1_RS_RAW.vhdr';
cfg1.run = 1;
% write the first EMG recording as run-1
data2bids(cfg1);
cfg1.TaskDescription = 'The subject was lying in the MRI scanner during a GABA MRS scan, while EMG was being recorded';
cfg1.task = 'resting';
cfg1.dataset = './original/nt05_EMG_SESS1_GABA_RAW.vhdr';
cfg1.run = 2;
% write the first EMG recording as run-2
data2bids(cfg1);
After I run it I get this error:
Insufficient number of outputs from right hand side of equal sign to satisfy assignment.
Error in ft_version (line 145)
ftver = a.Version;
Error in ft_preamble_init (line 50)
[FjmoT6aA_ft_ver, FjmoT6aA_ft_path] = ft_version;
Error in ft_preamble (line 83)
evalin('caller', full_cmd);
Error in data2bids (line 202)
ft_preamble init
Error in convert_to_bids (line 46)
data2bids(cfg1);
Initially cfg1 was cfg, but in one of the posted questions I found that it might be the variable's name so I changed it but still had the same error

  3 Comments

Walter Roberson
Walter Roberson on 13 Apr 2020
For whatever reason, the Contents.m file, in the directory you installed the toolbox into, is either missing or else does not have a useable version field.
Mahmoud Trabulsi
Mahmoud Trabulsi on 18 Apr 2020
What should I do?
I tried adding these to the code
restoredefaultpath
cd C:\Users\Adminstrator\Desktop\Thesis\fieldtrip\fieldtrip-20200310
addpath(pwd)
ft_defaults
and still go the same error
I started using MATLAB recently, so I have basic knowledge

Sign in to comment.

Answers (1)

Daniel M
Daniel M on 24 Apr 2020
Edited: Daniel M on 24 Apr 2020
Fieldtrip does not recommend adding the whole toolbox to your path. Just run the function ft_defaults.m and it will do it properly for you.
Try it by doing:
if isempty(which('ft_preprocessing'))
restoredefaultpath
startup;
ft_dir = path/to/main/fieldtrip/folder;
run(fullfile(ft_dir,'ft_defaults.m'));
end
The purpose of the if statement is so that you don't need to alter your path everytime you run your script, since this is a time-expensive process.
See also:

  0 Comments

Sign in to comment.

Tags

Products


Release

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by