Skip to content

Commit d6f8652

Browse files
committed
[Matlab] Refactor Dynamic.setAttribute error
1 parent d0c884c commit d6f8652

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

+nix/Dynamic.m

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,8 @@ function add_dyn_attr(obj, prop, mode)
2525

2626
function set_method(obj, val)
2727
if (strcmp(mode, 'r'))
28-
ME = MException('MATLAB:class:SetProhibited', sprintf(...
29-
'You cannot set the read-only property ''%s'' of %s', ...
30-
prop, class(obj)));
28+
msg = 'You cannot set the read-only property ''%s'' of %s';
29+
ME = MException('MATLAB:class:SetProhibited', msg, prop, class(obj));
3130
throwAsCaller(ME);
3231
end
3332

@@ -37,8 +36,8 @@ function set_method(obj, val)
3736
elseif ((strcmp(prop, 'units') || strcmp(prop, 'labels')) && (~iscell(val)))
3837
%-- BUGFIX: Matlab crashes, if units in Tags and MultiTags
3938
%-- or labels of SetDimension are set using anything else than a cell.
40-
ME = MException('MATLAB:class:SetProhibited', sprintf(...
41-
'This value only supports cells.'));
39+
msg = 'This value only supports cells.';
40+
ME = MException('MATLAB:class:SetProhibited', msg);
4241
throwAsCaller(ME);
4342
else
4443
fname = strcat(obj.alias, '::set', upper(prop(1)), prop(2:end));

0 commit comments

Comments
 (0)