diff --git a/FindBestParametersFile.m b/FindBestParametersFile.m index 6be5e8a74282a8594e95aed5ee70688edddaa373..d08ec6a3f52239b45f53ffec0ad0b392c5ba1683 100644 --- a/FindBestParametersFile.m +++ b/FindBestParametersFile.m @@ -1,11 +1,20 @@ -function [path,dirStruct] = FindBestParametersFile(pathToSearch) +function [path,dirStruct] = FindBestParametersFile(pathToSearch, useSub, key) %FINDBESTPARAMETERSFILE finds the file containing the best parameter set %based on the name. Assumes that the cost is given in parenthesis. % [path,name] = FindBestParametersFile(path) +if nargin<3, key='.'; end +if nargin<2, useSub=0; end + %% assert(exist(pathToSearch,'dir')>0,'Path does not exist. Are you in the right directory?'); +if useSub + pathToSearch=[pathToSearch '/**/*.mat']; +end files=dir(pathToSearch); assert(length(files)>2,'No files to search in the provided path') +names=string({files.name}); +files(cellfun(@isempty,regexp(names, key)))=[]; %removes all files not containing "key" + names=string({files.name}); values=double(regexprep(names,{'.*\(','\).*'},{'',''})); assert(any(~isnan(values)),'No files contains valid names. Make sure the files has the cost in parenthesis, e.g opt(12.34)'); diff --git a/SBPOP PACKAGE/SBPD/tools/mexmodelhandling/auxiliary/CVODEMEX/lib/CVODEmex25.lib b/SBPOP PACKAGE/SBPD/tools/mexmodelhandling/auxiliary/CVODEMEX/lib/CVODEmex25.lib index f5bff8e0b7b0d1f2cc8e54ae072755ee72f612b9..ac9503f17d60e04c4756518082a737a669e223d7 100644 Binary files a/SBPOP PACKAGE/SBPD/tools/mexmodelhandling/auxiliary/CVODEMEX/lib/CVODEmex25.lib and b/SBPOP PACKAGE/SBPD/tools/mexmodelhandling/auxiliary/CVODEMEX/lib/CVODEmex25.lib differ diff --git a/SaveFile.m b/SaveFile.m index 1035f565d30c35eb06ae9cec9eb080dca5efa5ab..153453697c893fe1f7980518ae12a299061f20c9 100644 --- a/SaveFile.m +++ b/SaveFile.m @@ -1,5 +1,7 @@ function [] = SaveFile(fileName,variable, variableName) -%SAVEFILE Saves a file with "fileName" with the content of a "variable" with +%SaveFile, used to save file (works with parfor) +%SaveFile(fileName,variable, variableName) +%Saves a file with "fileName" with the content of a "variable" with %name "variableName" S.(variableName)=variable;