How to use anonymous function in linkage ?

1 view (last 30 days)
RuiQi on 17 Jan 2017
Commented: Walter Roberson on 18 Jan 2017
I am trying to use my own function in linkage.
I completely have no idea and this tutorial does not help at all because the anonymous function in linkage has no inputs.
This is my code currently based on
test = linkage(array,'single','@custom');
This is how my custom distance is defined
function distance = custom(data_a, data_b)
distance = abs(data_a(1) - data_b(1)) + abs(data_a(2) - data_b(2))
can someone give me a good example of how I can call a @custom without any arguments ?

Answers (1)

Walter Roberson
Walter Roberson on 17 Jan 2017
test = linkage(array,'single', @custom);
Walter Roberson
Walter Roberson on 18 Jan 2017
Which MATLAB release are you using? The ability to use custom functions is not documented up to R2010b, but is documented starting with R2011a.

Sign in to comment.


Community Treasure Hunt

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

Start Hunting!