Skip to content

Commit 9500821

Browse files
Make solve function case insensitive and show errors for unknown options. Closes #20
1 parent bcb6b7d commit 9500821

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/+otp/Problem.m

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,10 +202,13 @@ function validateNewState(obj, newTimeSpan, newY0, newParameters)
202202
function sol = internalSolve(obj, varargin)
203203
p = inputParser;
204204
p.KeepUnmatched = true;
205+
% Filter name-value pairs not passed to odeset
205206
p.addParameter('Method', @ode15s, @(m) isa(m, 'function_handle'));
206207
p.parse(varargin{:});
207208

208-
options = obj.Rhs.odeset(p.Unmatched);
209+
% odeset is case sensitive for structs so convert unmatched parameters to a cell array
210+
unmatched = namedargs2cell(p.Unmatched);
211+
options = obj.Rhs.odeset(unmatched{:});
209212

210213
sol = p.Results.Method(obj.Rhs.F, obj.TimeSpan, obj.Y0, options);
211214

0 commit comments

Comments
 (0)