|
30 | 30 | invoker_list = [invoker_list, strcat(invoker_list, '.m')]; |
31 | 31 | callstack = dbstack; |
32 | 32 | funname = callstack(1).name; % Name of the current function |
33 | | -if (length(callstack) == 1 || ~ismember(callstack(2).name, invoker_list)) |
| 33 | +if length(callstack) > 1 && ismember(callstack(2).name, invoker_list) |
| 34 | + invoker = callstack(2).name; % Name of the function who calls this function |
| 35 | +else |
34 | 36 | % Private/unexpected error |
35 | 37 | error(sprintf('%s:InvalidInvoker', funname), ... |
36 | 38 | '%s: UNEXPECTED ERROR: %s should only be called by %s.', funname, funname, strjoin(invoker_list, ', ')); |
37 | | -else |
38 | | - invoker = callstack(2).name; % Name of the function who calls this function |
39 | 39 | end |
40 | 40 |
|
41 | 41 | if (nargin ~= 1) && (nargin ~= 10) |
|
435 | 435 |
|
436 | 436 | if ~isempty(unknown_fields) |
437 | 437 | wid = sprintf('%s:UnknownProbField', invoker); |
438 | | - if length(unknown_fields) == 1 |
439 | | - wmsg = sprintf('%s: problem with an unknown field %s; it is ignored.', invoker, strjoin(unknown_fields, ', ')); |
440 | | - else |
441 | | - wmsg = sprintf('%s: problem with unknown fields %s; they are ignored.', invoker, strjoin(unknown_fields, ', ')); |
442 | | - end |
| 438 | + wmsg = sprintf('%s: problem with unknown field(s) %s, which will be ignored.', invoker, strjoin(unknown_fields, ', ')); |
443 | 439 | warning(wid, '%s', wmsg); |
444 | 440 | warnings = [warnings, wmsg]; |
445 | 441 | end |
|
1023 | 1019 | % even though we have declared that this field will be ignored. |
1024 | 1020 | if ~isempty(unknown_fields) |
1025 | 1021 | wid = sprintf('%s:UnknownOption', invoker); |
1026 | | - if length(unknown_fields) == 1 |
1027 | | - wmsg = sprintf('%s: unknown option %s; it is ignored.', invoker, strjoin(unknown_fields, ', ')); |
1028 | | - else |
1029 | | - wmsg = sprintf('%s: unknown options %s; they are ignored.', invoker, strjoin(unknown_fields, ', ')); |
1030 | | - end |
| 1022 | + wmsg = sprintf('%s: unknown option(s) %s, which will be ignored.', invoker, strjoin(unknown_fields, ', ')); |
1031 | 1023 | warning(wid, '%s', wmsg); |
1032 | 1024 | warnings = [warnings, wmsg]; |
1033 | 1025 | end |
|
0 commit comments