MATLAB: Cell function not enough input arguments

cell function not enough input arguments images

Hi guys, I'm trying to run a function on a cell, e.g.
function [imagesS] = silhouette(A)
for ii = 6:length(A)
imagesS{ii} = im2bw(A{ii}, 0.6);
end
end
Which I call from another script,
imagesS = silhouette(A);
Where 'A' is a cell containing images. The error message I get is 'not enough input arguments', which doesn't make much sense to me. Any help appreciated.

Best Answer

I think the problem you are having is that you likely have the Statistics Toolbox installed. There is a function called silhouette() in the Statistics Toolbox.
That function takes more than 1 input argument.
If you enter
>>which silhouette
at the command line, what do you get back?
If it is something like:
matlab\toolbox\stats\stats\silhouette.m
then that is your problem.
It's never a good idea to have functions named the same as MathWorks' functions. I suggest you rename your function, mysilhouette.m, or whatever you like, but not silhouette.m.
Also, make sure your function is on the MATLAB path. Whatever folder you have the function in, you have to add that folder to the MATLAB search path.
Related Question