how can I compute distances:
6 次查看(过去 30 天)
显示 更早的评论
how can I compute distances:
I have a code which was running in matlab 2016:
Nat=1000;
pos=(rand(3, Nat)-0.5);
kr=dist(pos)+eye(Nat);
In my new matlab version (Matlab 2019), it seems to require an additional toolbox?
yours
Robin
0 个评论
采纳的回答
Robin Kaiser
2020-1-28
1 个评论
Walter Roberson
2020-1-28
kr = squeeze(sum((pos - permute(pos, [1 3 2])).^2,1)) + eye(NAT);
更多回答(3 个)
Fangjun Jiang
2020-1-27
Run the code and then run "license inuse". Only MATLAB is needed.
2 个评论
Walter Roberson
2020-1-28
It is not a backward incompatibility. dist() was never part of basic MATLAB. You probably had some third-party dist() function.
Walter Roberson
2020-1-27
dist() is part of the Deep Learning Toolbox
2 个评论
Walter Roberson
2020-1-28
No, it implies you used a third-party function before.
If you want to use basic MATLAB, then
kr = squareform(pdist(pos.')) + eye(Nat);
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Classification 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!