??? Undefined function or method 'isnan' for input arguments of type 'struct'.

5 次查看(过去 30 天)
I am trying to use downloaded code.(GGcall)
clear all
close all
colors={'r.' 'gx' 'b+' 'ys' 'md' 'cv' 'k.' 'r*' 'g*' 'b*' 'y*' 'm*' 'c*' 'k*' };
%the data
data.X=load('a.dat');
%normalization
data=clust_normalize(data,'range');
%parameters
param.c=8;
param.m=2;
param.e=1e-3;
param.val=1;
param.vis=0;
%Gath-Geva clustering
result = kmeans(data,param);
param.c=result.data.f;
result = GGclust(data,param);
%validation
result = validity(result,data,param);
plot(data.X(:,1),data.X(:,2),'b.',result.cluster.v(:,1),result.cluster.v(:,2),'ro');
hold on
plot(result.cluster.v(:,1),result.cluster.v(:,2),'ro');
%evaluation
new.X=data.X;
eval = clusteval(new,result,param);
result.validity
SO I got this: ??? Undefined function or method 'isnan' for input arguments of type 'struct'.
Error in ==> statremovenan at 29
wasnan = wasnan | any(isnan(y),2);
Error in ==> kmeans at 125
[ignore,wasnan,X] = statremovenan(X);
Error in ==> GGcall at 19
result = kmeans(data,param);
But the problem is that I could not find these lines neither in GGcall neither in any other programs it calls. By the way kmeans has 82 lines!

回答(1 个)

Vishal Rane
Vishal Rane 2013-6-10
The function stack is as follows:
GGcall > kmeans > statremovenan
The command
wasnan = wasnan | any(isnan(y),2);
at line 29 of the function statremovenan is causing the error.
The variable y is probably a structure type, causing the function isnan to fail since it does not operate on structs.

类别

Help CenterFile Exchange 中查找有关 Statistics and Machine Learning Toolbox 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by