Problems with Frequency Analysis

3 views (last 30 days)
I'm getting this error when running frequency analysis:
Undefined function 'ft_preprocessing' for input arguments of type 'struct'.
Error in freqanalysis_avg (line 23) data = ft_preprocessing(pcfg,data);
Error in super_freqanalysis_avg (line 57) freqanalysis_avg(cfg);
This is the preview of the Editor:
function super_freqanalysis_avg(mysubjects)
rootpathname = 'C:\data\';
directories = { 'P1\'; 'P2\'; 'P3\'; 'P4\'; 'P5\'; 'P6\'; 'P7\'; 'P8\'; 'P9\'; 'P10\'; 'P11\'; 'P12\'; 'P13\'; 'P14\'; 'P15\'; 'P16\'; };
subjectnumbers = { '1'; '2'; '3'; '4'; '5'; '6'; '7'; '8'; '9'; '10'; '11'; '12'; '13'; '14'; '15'; '16'; };
if nargin < 1 mysubjects = 1:length(directories) end;
for isub = mysubjects
for isess = 1:4
cfg.pathname = [rootpathname,directories{isub}];
cfg.cleanrestfname = [cfg.pathname,'datarestClean_',subjectnumbers{isub},'_',num2str(isess)];
cfg.cleanfname = [cfg.pathname,'datamazeClean',subjectnumbers{isub},'_',num2str(isess)];
cfg.freqfname = [cfg.pathname,'freqavg',subjectnumbers{isub},'_',num2str(isess)];
freqanalysis_avg(cfg);
end;
end;
If somebody could help in identifying where the problem lies and how to fix it, I'd greatly appreciate it. Thanks.

Accepted Answer

Star Strider
Star Strider on 31 Jul 2015
Put the entire toolbox (whatever one you’re using) in the same sub-directory on your MATLAB path, and then be certain that directory is on your MATLAB path. See the documentation on Search Path for relevant details and functions.
  2 Comments
Maazah Ali
Maazah Ali on 31 Jul 2015
You mean the super_freqanalysis file? That is in the same directory on the Matlab path but it is still giving the same error. What does it mean that the ft_preprocessing function is undefined? I did add the path but it doesn't work. Any help appreciated. Thanks once again.
Star Strider
Star Strider on 31 Jul 2015
I’m just guessing because I don’t have all the information. Those errors usually arise when MATLAB cannot find the function (or that the function doesn’t accept structures as arguments).
First, type this in the Command Window:
which ft_preprocessing -all
and see what the result is.
Your best option at this point is probably to contact whoever wrote the third-party toolbox you’re working with and ask them. Be sure to tell them that you checked with the path and which functions, and you are certain that the entire toolbox is in your MATLAB search path.

Sign in to comment.

More Answers (0)

Categories

Find more on File Operations in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!