How to resolve this issue in Cluster "Error using cluster Too many input arguments. Error in try_Clust (line 7) T = cluster(Z,'MaxClust',3);

1 view (last 30 days)
I am getting error on my Mac Book OSx version
I just ran the live script ClusterDataUsingDistanceCriterionExample.mlx
I am pasting the code in short below (Its part of live script):
clear; clc;
load fisheriris
Z = linkage(meas,'average','chebychev');
T = cluster(Z,'MaxClust',3);
cutoff = median([Z(end-2,3) Z(end-1,3)]);
dendrogram(Z,'ColorThreshold',cutoff)
The error is as posted below:
Error using cluster
Too many input arguments.
Error in try_Clust (line 7)
T = cluster(Z,'MaxClust',3);
Details of the Matlab version being installed is here. For better assimilation I tried the same code on matlab.mathworks.com the online version. Error is the same.
Thanks in advance.
ver
-----------------------------------------------------------------------------------------------------
MATLAB Version: 9.9.0.1524771 (R2020b) Update 2
MATLAB License Number: 40841973
Operating System: macOS Version: 11.5 Build: 20G71
Java Version: Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
which cluster -all
/Users/makamkirankumar/Desktop/EMG_Analysis/emglab1.03/m files/cluster.m
/Applications/MATLAB_R2020b.app/toolbox/bioinfo/bioinfo/@phytree/cluster.m % phytree method
/Applications/MATLAB_R2020b.app/toolbox/stats/stats/@gmdistribution/cluster.m % gmdistribution method
/Applications/MATLAB_R2020b.app/toolbox/stats/stats/cluster.m % Shadowed

Accepted Answer

Ananya Tewari
Ananya Tewari on 13 Aug 2021
Hi,
I tried executing the said example at my end in MATLAB R2020b and it executed successfully without giving any errors. I suspect there is another function named "cluster" which is shadowing the MATLAB function "cluster". This is evident in the output of your "which cluster -all" command.
The cluster function which is being executed is :
/Users/makamkirankumar/Desktop/EMG_Analysis/emglab1.03/m files/cluster.m
Rather than the MATLAB defined function:
/Applications/MATLAB_R2020b.app/toolbox/stats/stats/cluster.m % Shadowed
It is recommended not to use the same function names as MATLAB defined functions. You can try renaming the user-defined "cluster" function to resolve the issue.

More Answers (0)

Categories

Find more on Introduction to Installation and Licensing 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!