# calculating euclidean distance

2 visualizaciones (últimos 30 días)
FIR el 17 de Feb. de 2012
Comentada: NAVEEN KUMAR el 27 de Abr. de 2017
I have a dataset of images(175images),i have found the mean of that and have saved,next i have query image from dataset,now i want to calculate euclidean distance and want to retrieve that image,
i did
for n=1:175; Distance=EuD( Features{1,n},FeaturesQuery); D{n}=Distance;
end
i get error as
Cell contents assignment to a non-cell array object.
Features=<1x175 cell>
FeaturesQuery=104.8872
##### 0 comentariosMostrar -1 comentarios más antiguosOcultar -1 comentarios más antiguos

Iniciar sesión para comentar.

### Respuestas (2)

Tom Lane el 17 de Feb. de 2012
It is likely that you have assigned D to some value, perhaps a plain numeric value, earlier in the function. So it is not a cell array, and you can't assign into it using cell array notation. Just before you start the loop in which you want to assign into cells of D, try inserting either of the following lines:
clear D
D = cell(1,175);
##### 0 comentariosMostrar -1 comentarios más antiguosOcultar -1 comentarios más antiguos

Iniciar sesión para comentar.

Image Analyst el 17 de Feb. de 2012
I just did this:
for n=1:175
Distance=10; %EuD( Features{1,n},FeaturesQuery);
D{n}=Distance;
end
and it ran fine. I didn't even preallocate D to be a cell array of length 175. No errors or warnings whatsoever. Now, we don't know what EuD returns but I thought you could toss anything you wanted into a cell so I'm not sure why the "D{n}=Distance" line would complain, regardless of what class type Distance was. Let me ask you, what class type and/or value does Distance have?
##### 7 comentariosMostrar 6 comentarios más antiguosOcultar 6 comentarios más antiguos
NAVEEN KUMAR el 27 de Abr. de 2017

Iniciar sesión para comentar.

### Categorías

Más información sobre Mathematics and Optimization en Help Center y File Exchange.

### Community Treasure Hunt

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

Start Hunting!

Translated by