diff --git a/README.md b/README.md index e1be6a1..4f02110 100644 --- a/README.md +++ b/README.md @@ -8,16 +8,18 @@ optimal control. Dependency | Website | Required? ----------------------------------- | --------------------------------------------------------------- | --------- -MATLAB | https://www.mathworks.com/products/matlab.html | yes (>=2018a) +MATLAB | https://www.mathworks.com/products/matlab.html | yes\* MATLAB Optimization Toolbox | https://www.mathworks.com/products/optimization.html | yes -Nemoh | https://github.com/LHEEA/Nemoh | yes +NEMOH | https://github.com/LHEEA/Nemoh | yes WAFO1 | https://github.com/wafo-project/wafo | no MATLAB Parallel Computing Toolbox | https://www.mathworks.com/products/parallel-computing.html | no -The oldest compatible version of MATLAB currently tested is **MATLAB 2018a -(9.4.0.949201)**. Please help the development team by reporting compatibility -with older versions [HERE]( -https://github.com/SNL-WaterPower/WecOptTool/issues/91). +\* The latest WecOptTool release, version 0.1.0, was tested on **MATLAB +2020a**, whilst the oldest compatible version known is **MATLAB 2018a**. Please +help the development team by reporting compatibility with other versions +[HERE]( https://github.com/SNL-WaterPower/WecOptTool/issues/91). The +development version will support the latest available version of MATLAB, but no +guarantees are given regarding legacy MATLAB support. 1_WecOptTool requires an input wave spectra which is formatted to match the output of the WAFO toolbox. These spectra can also be produced 'by diff --git a/dependencyCheck.m b/dependencyCheck.m index 4259adc..73de927 100644 --- a/dependencyCheck.m +++ b/dependencyCheck.m @@ -39,28 +39,20 @@ optimizationToolboxLicensed = license('test', "Optimization_Toolbox"); % Second check if installed -addons = matlab.addons.installedAddons(); - -if isempty(addons) - - optimizationToolboxInstalled = false; - -else - - iOptimizationToolbox = addons.Name == "Optimization Toolbox"; - - if ~iOptimizationToolbox - optimizationToolboxInstalled = false; - else - optimizationToolboxInstalled = ... - addons.Enabled(iOptimizationToolbox); +installedProducts = ver; +installedNames = {installedProducts(:).Name}; +optimizationToolboxInstalled = false; + +for name = installedNames + if contains(name, "Optimization Toolbox") + optimizationToolboxInstalled = true; + break end - end if optimizationToolboxLicensed && optimizationToolboxInstalled fprintf('Optimization Toolbox: Found\n'); -elseif ~optimizationToolboxLicensed && opmizationToolboxInstalled +elseif ~optimizationToolboxLicensed && optimizationToolboxInstalled allfoundflag = false; fprintf('Optimization Toolbox: Unlicensed\n'); else @@ -102,7 +94,7 @@ elseif ~parallelToolboxLicensed && parallelToolboxInstalled fprintf('Parallel Toolbox: Unlicensed\n'); else - fprintf('Paralell Toolbox: Not Installed\n'); + fprintf('Parallel Toolbox: Not Installed\n'); end %% WAFO diff --git a/docs/user/setup.rst b/docs/user/setup.rst index 39c9e60..e1a5067 100644 --- a/docs/user/setup.rst +++ b/docs/user/setup.rst @@ -14,8 +14,7 @@ WecOptTool. +----------------------+------------------------------------------------------------+-----------+ | Dependency | Website | Required? | +======================+============================================================+===========+ - | MATLAB | https://www.mathworks.com/products/matlab.html | yes | - | | | (>=2018a) | + | MATLAB | https://www.mathworks.com/products/matlab.html | yes\* | +----------------------+------------------------------------------------------------+-----------+ | MATLAB Optimization | https://www.mathworks.com/products/optimization.html | yes | | Toolbox | | | @@ -29,10 +28,12 @@ WecOptTool. | Toolbox [#f2]_ | | | +----------------------+------------------------------------------------------------+-----------+ -The oldest compatible version of MATLAB currently tested is **MATLAB 2018a -(9.4.0.949201)**. Please help the development team by reporting compatibility -with older versions `HERE -`__. +\* The latest WecOptTool release, version 0.1.0, was tested on **MATLAB +2020a**, whilst the oldest compatible version known is **MATLAB 2018a**. Please +help the development team by reporting compatibility with other versions `HERE +`__. The development +version will support the latest available version of MATLAB, but no guarantees +are given regarding legacy MATLAB support. .. _user-setup-download: diff --git a/test_results_serial.pdf b/test_results_serial.pdf new file mode 100644 index 0000000..4998392 Binary files /dev/null and b/test_results_serial.pdf differ diff --git a/toolbox/+WecOptLib/+utils/getSrcRootPath.m b/toolbox/+WecOptLib/+utils/getSrcRootPath.m index bf7198a..871e81c 100644 --- a/toolbox/+WecOptLib/+utils/getSrcRootPath.m +++ b/toolbox/+WecOptLib/+utils/getSrcRootPath.m @@ -27,7 +27,7 @@ % Linux requires a leading slash if ~ispc - srcRootPath = append(filesep, srcRootPath); + srcRootPath = [filesep, srcRootPath]; end end diff --git a/toolbox/+WecOptLib/+utils/hasParallelToolbox.m b/toolbox/+WecOptLib/+utils/hasParallelToolbox.m index 22e929f..1184dee 100644 --- a/toolbox/+WecOptLib/+utils/hasParallelToolbox.m +++ b/toolbox/+WecOptLib/+utils/hasParallelToolbox.m @@ -21,24 +21,17 @@ licensed = logical(license('test', "Distrib_Computing_Toolbox")); - addons = matlab.addons.installedAddons(); - - if isempty(addons) - - installed = false; - - else - - iParallelToolbox = addons.Name == "Parallel Computing Toolbox"; + installedProducts = ver; + installedNames = {installedProducts(:).Name}; + installed = false; - if ~iParallelToolbox - installed = false; - else - installed = addons.Enabled(iParallelToolbox); + for name = installedNames + if contains(name, "Parallel Computing Toolbox") + installed = true; + break end - end - + combined = licensed && installed; end diff --git a/toolbox/+WecOptLib/+utils/writeConfig.m b/toolbox/+WecOptLib/+utils/writeConfig.m index 85f5f42..5e984fd 100644 --- a/toolbox/+WecOptLib/+utils/writeConfig.m +++ b/toolbox/+WecOptLib/+utils/writeConfig.m @@ -41,7 +41,7 @@ function writeConfig(key, value, varargin) if exist(configPath, 'file') config = jsondecode(fileread(configPath)); else - config = struct(p.Results.key, p.Results.value); + config = struct(char(p.Results.key), p.Results.value); end if strcmp(p.Results.value, "")