i want to calculate euclidean distance between dataset with query where dataset (36x9) and query(3x8).

1 view (last 30 days)
This is my formula :
jarak = jarak + sqrt(ZRef{j,1:8}) - ZQuery({j,1:8}.^2;
when I'm running, there is an error Cell contents reference from a non-cell array object.
Thanks you

Answers (2)

Image Analyst
Image Analyst on 4 Mar 2017
ZQuery and ZRef are not cell arrays. Try using parentheses instead of braces, and putting them in the proper locations.
jarak = jarak + sqrt((ZRef(j,1:8) - ZQuery(j,1:8)) .^ 2);

Walter Roberson
Walter Roberson on 4 Mar 2017
If you are more or less moving the query over the whole dataset looking for best match, then I suggest using nlfiter if you need to form an explicit euclidean distance. If you are looking for "best match" then I gather that it would typically be computed by cross-correlation.

Community Treasure Hunt

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

Start Hunting!