Skip to content

Commit e41a01f

Browse files
committed
test:matlab: better function implementation
1 parent 2c2b31c commit e41a01f

File tree

3 files changed

+11
-23
lines changed

3 files changed

+11
-23
lines changed

src/pymap3d/tests/get_matlab_toolboxes.m

Lines changed: 0 additions & 21 deletions
This file was deleted.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
function h = has_matlab_toolbox(name)
2+
3+
addons = matlab.addons.installedAddons();
4+
5+
h = any(ismember(addons.Name, name)) && matlab.addons.isAddonEnabled(name) == 1;
6+
7+
end
8+
9+

src/pymap3d/tests/matlab_engine.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ def has_matmap3d(eng) -> bool:
3333

3434
@functools.cache
3535
def has_aerospace(eng) -> bool:
36-
return eng.get_matlab_toolboxes()["aerospace"]
36+
return eng.has_matlab_toolbox("Aerospace Toolbox")
3737

3838

3939
@functools.cache
4040
def has_mapping(eng) -> bool:
41-
return eng.get_matlab_toolboxes()["mapping"]
41+
return eng.has_matlab_toolbox("Mapping Toolbox")
4242

4343

4444
def matlab_ecef2eci(eng, matmap3d: bool, utc: datetime, ecef):

0 commit comments

Comments
 (0)