MATLAB: Error in MATLAB median inside isoutlier function

embedded matlab functionerrorisoutliermedian

I'm having the following error and I don't understand how to get around it. This error is on Matlab's function median when using isoutlier. My MATLAB's version is 2018b.
% Error message shown in Command Window
Error using median
Too many input arguments.
Error in locateoutliers (line 108)
center = median(a,1,'omitnan');
Error in isoutlier (line 144)
[tf, lthresh, uthresh, center] = locateoutliers(a, method, ...
I've been using this code for some time now and just recently I've been having this error. I've tried with the same data that worked before and I still obtain the same message now.
My code is basically organized in the following way:
% Data to analyze (may contain NaN)
rr = Peaks.r; % 1x900 double
% Find Outliers
out = isoutlier(rr);
When I open the line on MATLAB's intrinsic function:
% Where the error happens.
% This is MATLAB's function (obviously NOT written by me)
case 'median'
madfactor = -1 /(sqrt(2)*erfcinv(3/2)); %~1.4826
center = median(a,1,'omitnan');
amad = madfactor*median(abs(a - center), 1, 'omitnan');
lowerbound = center - p*amad;
upperbound = center + p*amad;
As I said earlier, the exact same code used to work. It's an error that is happening on MATLAB's function, so I don't know how to solve this.
I'm also havign a very similar problem with MATLAB's function normalize, and the error is on the function sum.
I didn't overwrite any function.
What can I do to fix this?

Best Answer

You said you didn't overwrite any function, but did you download a function or a collection of functions or are you shadowing the functions in MATLAB? Let's check to make sure you're using the built-in sum function and the median function included in MATLAB.
which -all sum
which -all median
If you see versions of those functions outside of the matlabroot directory, rename or remove them. There will be multiple versions of those functions inside the matlabroot directory, many of which are in directories whose paths include the @ symbol. Leave those alone; don't rename or remove them.