Mercurial > repos > public > sbplib
changeset 481:970f1df2bfcf feature/sublassable_cellarray
Implement handeling of stacked indexing
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Wed, 02 Aug 2017 12:17:09 +0200 |
parents | 4ce12f8b561c |
children | b90f8108ea5f |
files | Cell.m CellTest.m |
diffstat | 2 files changed, 6 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
diff -r 4ce12f8b561c -r 970f1df2bfcf Cell.m --- a/Cell.m Wed Aug 02 12:01:25 2017 +0200 +++ b/Cell.m Wed Aug 02 12:17:09 2017 +0200 @@ -61,8 +61,11 @@ function B = subsref(A, S) switch S(1).type case '()' - b = subsref(A.data, S); + b = subsref(A.data, S(1)); B = callConstructor(A, b); + if length(S) > 1 + B = subsref(B,S(2:end)); + end case '{}' B = subsref(A.data, S); case '.'
diff -r 4ce12f8b561c -r 970f1df2bfcf CellTest.m --- a/CellTest.m Wed Aug 02 12:01:25 2017 +0200 +++ b/CellTest.m Wed Aug 02 12:17:09 2017 +0200 @@ -49,7 +49,8 @@ function testRoundIndexWithProperty(testCase) A = Cell({3,2,1}); - testCase.verifyEqual(A([1,3]).data, {3, 1}); + result = A([1,3]).data; + testCase.verifyEqual(result, {3, 1}); end function testSubAssignment(testCase)