Skip to content

Commit 1d3976e

Browse files
committed
OK, I got subscript indexing working for matlab
1 parent e18862d commit 1d3976e

File tree

1 file changed

+37
-9
lines changed

1 file changed

+37
-9
lines changed

src/+otp/RHS.m

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
classdef RHS
1+
classdef RHS < matlab.mixin.indexing.RedefinesParen
22
properties (SetAccess = private)
33
F
44

@@ -22,6 +22,29 @@
2222
OnEvent
2323
end
2424

25+
methods (Access = protected)
26+
function newRHS = parenReference(obj, indexClass)
27+
objF = obj.F;
28+
subst.type = '()';
29+
subst.subs = indexClass.Indices;
30+
newF = @(t, y) subsref(objF(t, y), subst);
31+
newRHS = otp.RHS(newF);
32+
end
33+
34+
function newRHS = parenAssign(~, ~,~)
35+
error('');
36+
end
37+
38+
function newRHS = parenListLength(~, ~,~)
39+
error('');
40+
end
41+
42+
function newRHS = parenDelete(~, ~,~)
43+
error('');
44+
end
45+
end
46+
47+
2548
methods
2649
function obj = RHS(F, varargin)
2750
obj.F = F;
@@ -41,14 +64,12 @@
4164
newRHS = otp.RHS(newF);
4265
end
4366

44-
function newRHS = subsref(obj, vs)
45-
if vs.type == '.'
46-
newRHS = obj.(vs.subs);
47-
else
48-
objF = obj.F;
49-
newF = @(t, y) subsref(objF(t, y), vs);
50-
newRHS = otp.RHS(newF);
51-
end
67+
function newRHS = cat(obj, other)
68+
error('');
69+
end
70+
71+
function newRHS = size(obj)
72+
error('');
5273
end
5374

5475
function opts = odeset(obj, varargin)
@@ -65,5 +86,12 @@
6586
'Vectorized', obj.Vectorized, ...
6687
varargin{:});
6788
end
89+
90+
end
91+
92+
methods (Static)
93+
function newRHS = empty(obj, other)
94+
error('');
95+
end
6896
end
6997
end

0 commit comments

Comments
 (0)