just a guess as i do not have your data:
with k=947 (last outer loop) m starts from 948 and runs backwards to 947. As your matrix probably only has 947 columns you get this error....

Ayesha Khan schrieb:
Hi,

I'm trying to calculate euclidean distance for my matrix rx1.  Its a big
matrix with 947 elements. However when i do the following,

for(k in 1:947) for(m in (k+1):947){
A =rbind(A,c(k,m,ED(rx1[,k], rx1[,m])))
}
I get the following error:
ED(rx1[,k], rx1[,m]) : subscript out of bounds

I checked for k in 1:100 and it runs fine; its a huge matrix and takes
atleast an hour to run before I get the results so I dont wanna run the
whole thing again and get the same error. Please help!




______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to