Mercurial > repos > public > sbplib
diff Map.m @ 951:a6c5e73ff44e
Better errors in Map()
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Fri, 07 Dec 2018 16:10:58 +0100 |
parents | effd75b113ba |
children |
line wrap: on
line diff
--- a/Map.m Sat Nov 24 14:55:48 2018 +0000 +++ b/Map.m Fri Dec 07 16:10:58 2018 +0100 @@ -59,6 +59,9 @@ function v = subsref(obj, S) switch S(1).type case '()' + if length(S.subs) > 1 + error('sbplib:Map:multipleKeys', 'Multiple dimensions are not supported. Use a cell array as a key instead.'); + end k = S.subs{1}; try v = get(obj, k); @@ -81,6 +84,9 @@ function obj = subsasgn(obj, S, v); switch S(1).type case '()' + if length(S.subs) > 1 + error('sbplib:Map:multipleKeys', 'Multiple dimensions are not supported. Use a cell array as a key instead.'); + end k = S.subs{1}; set(obj, k, v); otherwise