diff --git a/CatSims.m b/CatSims.m new file mode 100644 index 0000000000000000000000000000000000000000..3ea3cbf5221f521f506c1afedda22b4803e9bb71 --- /dev/null +++ b/CatSims.m @@ -0,0 +1,16 @@ +function [S] = CatSims(structs) + %Cat Concatenates multiple structs. If concatenating simulation structs from IQM, you probably want to use CatSim instead. + + S = structs(1); + for i = 2:length(structs) + fields = fieldnames(S); + for k = 1:numel(fields) + aField = fields{k}; % EDIT: changed to {} + if strcmp(aField,'time') % If field is a horizontal 1D array + S.(aField) = horzcat(S.(aField), structs(i).(aField)); + elseif contains(aField, 'values')%if field is a vertical 1D array + S.(aField) = vertcat(S.(aField), structs(i).(aField)); + end + end + end +end diff --git a/IQM Tools/IQMpro/tools/01-MEXmodels/auxiliary/mexcompileIQM.m b/IQM Tools/IQMpro/tools/01-MEXmodels/auxiliary/mexcompileIQM.m index 949783290091606c98a515ef971a33d34ddf7015..8c2281c70792b65752a270edff3f9c2803b97ab9 100644 --- a/IQM Tools/IQMpro/tools/01-MEXmodels/auxiliary/mexcompileIQM.m +++ b/IQM Tools/IQMpro/tools/01-MEXmodels/auxiliary/mexcompileIQM.m @@ -18,5 +18,14 @@ else end includefolder = fileparts(which('mexmathaddon.h')); % do compilation +try eval(sprintf('mex -O -I''%s'' %s.c ''%s'';',includefolder,filename,libpath)); +catch err + if contains(err.message, 'is not a MEX file') + disp(getReport(err)) + disp('When running on linux, this error sometimes occurs, but the model still works.') + else + rethrow(err) + end +end diff --git a/SBPOP PACKAGE/SBPD/tools/mexmodelhandling/auxiliary/mfiles/mexcompileSBPD.m b/SBPOP PACKAGE/SBPD/tools/mexmodelhandling/auxiliary/mfiles/mexcompileSBPD.m index 30d937a1ad417b99a9bb24639a283cdd0e3f6e62..06907099530bab460add05f6d4e447bd30d10d3c 100644 --- a/SBPOP PACKAGE/SBPD/tools/mexmodelhandling/auxiliary/mfiles/mexcompileSBPD.m +++ b/SBPOP PACKAGE/SBPD/tools/mexmodelhandling/auxiliary/mfiles/mexcompileSBPD.m @@ -1,14 +1,14 @@ function [] = mexcompileSBPD(filename) -% mexcompileSBPD: Compiles an SBmodel that has been converted to a mexfile.h +% mexcompileSBPD: Compiles an SBmodel that has been converted to a mexfile.h % and mexfile.c and links it with the CVODE integrator from the SUNDIALS -% suite (http://www.llnl.gov/CASC/sundials/). -% +% suite (http://www.llnl.gov/CASC/sundials/). +% % USAGE: % ====== % [] = mexcompileSBPD(mexfile) % -% mexfile: Basename of the model files (mexfile.c and mexfile.h) - +% mexfile: Basename of the model files (mexfile.c and mexfile.h) + % Information: % ============ % Copyright (C) 2005-2013 Henning Schmidt, henning@sbtoolbox2.org @@ -17,15 +17,15 @@ function [] = mexcompileSBPD(filename) % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2 of the License, or % (at your option) any later version. -% +% % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. -% +% % You should have received a copy of the GNU General Public License % along with this program; if not, write to the Free Software -% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 % USA. if ~isunix, @@ -35,5 +35,15 @@ else end includefolder = fileparts(which('mexmathaddon.h')); % do compilation -eval(sprintf('mex -O -I''%s'' %s.c ''%s'';',includefolder,filename,libpath)); - +try + eval(sprintf('mex -O -I''%s'' %s.c ''%s'';',includefolder,filename,libpath)); + +catch err + if contains(err.message, 'is not a MEX file') + disp(getReport(err)) + disp('When running on linux, this error sometimes occurs, but the model still works.') + else + rethrow(err) + end +end +end \ No newline at end of file diff --git a/StructFieldCat.m b/StructFieldCat.m index 9657ebcb682f5f440dabc78741da6fddbd4f3436..ffefd4de90e0555de60c427ad7b2b1ebcbd35824 100644 --- a/StructFieldCat.m +++ b/StructFieldCat.m @@ -1,4 +1,5 @@ function S = StructFieldCat(S, T, dim) +%STRUCTFIELDCAT: concatenate two structs. if nargin<3 || isempty(dim) dim=1; end diff --git a/StructsFieldCat.m b/StructsFieldCat.m index 69561b8d356fbd7683472e4bdace354bf9f50e34..c80f6f7a885e3c49ac0113fb354809014d8c327c 100644 --- a/StructsFieldCat.m +++ b/StructsFieldCat.m @@ -1,6 +1,5 @@ function [s] = StructsFieldCat(structs, dim) -%STRUCTSFIELDCAT Summary of this function goes here -% Detailed explanation goes here +%STRUCTSFIELDCAT Concatenates multiple structs. If concatenating simulation structs from IQM, you probably want to use CatSim instead. if nargin<2 || isempty(dim) dim=1; end @@ -10,3 +9,5 @@ for i = 2:length(structs) end end + +