Im recieving an error that I dont understand using FCM.
If I set options like it mentions in the Documentation it outputs this error:
??? Error using ==> zeros
Leading inputs must be numeric.
Error in ==> fcm at 83
obj_fcn = zeros(max_iter, 1); % Array for objective function
Error in ==> fcm at 82
[centers, U, objFun] = fcm(data, 6, 'options');
If I remove the options the code runs fine, here is the full code:
[centers, U, objFun] = fcm(data, 6, 'options');
plot(data(:,1), data(:,2),'o');
maxU = max(U);
index1 = find(U(1, :) == maxU);
index2 = find(U(2, :) == maxU);
line(data(index1,1),data(index1, 2),'linestyle','none',...
'marker','*','color','g');
line(data(index2,1),data(index2, 2),'linestyle','none',...
'marker', '*','color','r');
The problem is that
fcmexpects to receive an options array, not a string. You’re passing'options', but instead, you should do something like this:I’m using the default values specified in the
fcmdocumentation. You may change them to whatever you like.Alternatively, the documentation specifies that if you want the default value, you can just set the option to
NaN, so feel free to do that for whatever options you want defaults for.