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

5 Ansichten (letzte 30 Tage)
Milenko
Milenko am 10 Jun. 2013
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!

Antworten (1)

Vishal Rane
Vishal Rane am 10 Jun. 2013
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.

Kategorien

Mehr zu Statistics and Machine Learning Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by