Is matlab function distance is broken ?

Hello,
I try to calculate the distance between two points on a sphere. It seems that the function distance is built-in https://www.mathworks.com/help/map/ref/distance.html
But I'm unable to make it work, even the examples in the doc seem to not work :
arclen = distance('gc',[37,-76],[37,-9])
arclen = distance('rh',[37,-76],[37,-9])
I always have this error :
Check for missing argument or incorrect argument data type in call to function 'distance'.
I even tried syntax like that :
[arclen,az] = distance('gc',[37,-76],[37,-9])
But nothing seems to work, why ? I'm using Matlab R2020a, is it deprecated ?

5 Commenti

It works fine on my system. Can you show the output of
which distance
I receive this output
>> which distance
'distance' not found.
Here is my full version
>> ver
-----------------------------------------------------------------------------------------------------
MATLAB Version: 9.8.0.1380330 (R2020a) Update 2
MATLAB License Number:
Operating System: Linux 4.19.0-9-amd64 #1 SMP Debian 4.19.118-2 (2020-04-29) x86_64
Java Version: Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
-----------------------------------------------------------------------------------------------------
MATLAB Version 9.8 (R2020a)
Simulink Version 10.1 (R2020a)
Control System Toolbox Version 10.8 (R2020a)
Curve Fitting Toolbox Version 3.5.11 (R2020a)
DSP System Toolbox Version 9.10 (R2020a)
Image Processing Toolbox Version 11.1 (R2020a)
Instrument Control Toolbox Version 4.2 (R2020a)
Optimization Toolbox Version 8.5 (R2020a)
Parallel Computing Toolbox Version 7.2 (R2020a)
Signal Processing Toolbox Version 8.4 (R2020a)
Statistics and Machine Learning Toolbox Version 11.7 (R2020a)
Symbolic Math Toolbox Version 8.5 (R2020a)
Ameer Hamza
Ameer Hamza il 3 Giu 2020
Modificato: Ameer Hamza il 3 Giu 2020
You need mapping toolbox to use this function: https://www.mathworks.com/products/mapping.html
Thank you, I didn't see it.
How I can accept your answer ?
Aymeric, I added it as an answer. You can accept it.

Accedi per commentare.

Più risposte (1)

Mark Brandon
Mark Brandon il 2 Giu 2020
It's your install.
Screen grab from those commands on my 2020a Update 2
un-install and clean install again?
good luck. MB

Categorie

Prodotti

Release

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by