How to use anonymous function in linkage ?
1 次查看(过去 30 天)
显示 更早的评论
I completely have no idea and this tutorial https://www.mathworks.com/help/matlab/matlab_prog/anonymous-functions.html 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))
end
can someone give me a good example of how I can call a @custom without any arguments ?
0 个评论
回答(1 个)
Walter Roberson
2017-1-17
test = linkage(array,'single', @custom);
4 个评论
Walter Roberson
2017-1-18
Which MATLAB release are you using? The ability to use custom functions is not documented up to R2010b, but is documented starting with R2011a.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!