Using abbreviations for parameter-value input pairs - why does cellfun's `'UniformOutput', false` work as `'un', 0`?

前端 未结 2 1379
遇见更好的自我
遇见更好的自我 2021-01-11 09:48

As a frequent user of cellfun(..., \'UniformOutput\', false), I was surprised to discover that the latter two arguments could be input as cellfun(..., \'u

2条回答
  •  星月不相逢
    2021-01-11 10:50

    If a routine uses MATLAB's inputParser functionality then usually any parameter name can be shortened such that it is still unambiguous and is matched case insensitively. The same is true for properties of objects such as get(gcf, 'pos') as a shorter version of get(gcf, 'Position').

    However, I don't know if there is any documentation on this usage and I suggest you try it and see.

    And 0 is usually equivalent to false (non-zero being true).

    PS I would suggest that using these shortcuts is fine at the command line but when writing functions and scripts it is better to use the full names.

提交回复
热议问题