简体   繁体   English

在MATLAB函数参数中使用'full'

[英]Use of 'full' in MATLAB function arguments

In some libraries, eg the one below from CVX, I notice the argument full . 在某些库中,例如CVX下面的库,我注意到参数full I can't seem to find any documentation that explains what this is and why it's there. 我似乎找不到任何说明这是什么及其原因的文档。 Can anyone explain? 谁能解释?

EDIT: As suggested, here is a link to the function . 编辑:按照建议,这是该功能链接 Please note that this is the entire function. 请注意,这是整个功能。

function y = cvx_isaffine( x, full ) 
narginchk(1,2);
if nargin == 1,
    y = true;
else
    y = true( size( x ) );
end

In this function, the test if nargin == 1 checks to see if the second input argument, full is given. 在此函数中, if nargin == 1测试将检查是否给出了第二个输入参数full If it is, the output is a logical array of same size as x . 如果是,则输出为与x大小相同的逻辑数组。 If it is not, then the output is a scalar logical array. 如果不是,则输出为标量逻辑数组。

That is, 那是,

M = randn(10,3);
cvx_isaffine(M)

returns true , whereas 返回true ,而

cvx_isaffine(M,1)

returns a 10x3 array with all elements are true . 返回所有元素均为true的10x3数组。

You can fill in whatever you want for this second argument, as its value is not used anywhere. 您可以为第二个参数填写任何内容,因为它的值没有在任何地方使用。 Just the presence of the 2nd argument is a flag for a change in behavior. 只是第二个参数的存在是行为改变的标志。

The function seems to not be documented because it is meant for internal use, and not for use by the end-user. 该功能似乎没有记录,因为它仅供内部使用,而不供最终用户使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM