File: helper_vdist.m

package info (click to toggle)
pymap3d 3.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 540 kB
  • sloc: python: 3,742; ruby: 105; makefile: 4
file content (23 lines) | stat: -rw-r--r-- 512 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
function helper_vdist(lat, lon, N)

  addons = matlab.addons.installedAddons();

  M1 = repmat(lat, N, 1);
  M2 = repmat(lon, N, 1);
  L1 = rand(N,1);
  L2 = rand(N,1);

  if any(addons.Name == "Mapping Toolbox")
    disp("Using Mapping Toolbox distance()")
    f = @() distance(lat, lon, L1, L2);
  elseif ~isempty(what("matmap3d"))
    disp("Using matmap3d.vdist()")
    f = @() matmap3d.vdist(M1, M2, L1, L2);
  else
    error("Matlab Mapping Toolbox is not installed")
  end

  t = timeit(f);
  disp(t)

end