Skip to content

Commit

Permalink
compare: combine matlab fcns
Browse files Browse the repository at this point in the history
  • Loading branch information
scivision committed Nov 24, 2023
1 parent 6ce45b3 commit 5e27a82
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 20 deletions.
9 changes: 0 additions & 9 deletions scripts/matlab/has_aerospace_toolbox.m

This file was deleted.

9 changes: 0 additions & 9 deletions scripts/matlab/has_map_toolbox.m

This file was deleted.

4 changes: 2 additions & 2 deletions scripts/matlab/matlab_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def matlab_engine():

@functools.cache
def has_aerospace(eng: matlab.engine.matlabengine.MatlabEngine) -> bool:
if eng.has_aerospace_toolbox():
if eng.matlab_toolbox().has_aerospace:
return True

cwd = Path(__file__).parent
Expand All @@ -28,7 +28,7 @@ def has_aerospace(eng: matlab.engine.matlabengine.MatlabEngine) -> bool:


def has_mapping(eng: matlab.engine.matlabengine.MatlabEngine) -> bool:
if eng.has_map_toolbox():
if eng.matlab_toolbox().has_mapping:
return True

cwd = Path(__file__).parent
Expand Down
27 changes: 27 additions & 0 deletions scripts/matlab/matlab_toolbox.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
function h = matlab_toolbox()

h = struct(mapping=has_mapping(), aerospace=has_aerospace())

end


function has_map = has_mapping()
if usejava('jvm')
addons = matlab.addons.installedAddons();

has_map = any(contains(addons.Name, 'Mapping Toolbox'));
else
has_map = ~isempty(ver("map"));
end
end


function has_map = has_aerospace()
if usejava('jvm')
addons = matlab.addons.installedAddons();

has_map = any(contains(addons.Name, 'Aerospace Toolbox'));
else
has_map = ~isempty(ver("aero"));
end
end

0 comments on commit 5e27a82

Please sign in to comment.