简体   繁体   中英

Use of 'full' in MATLAB function arguments

In some libraries, eg the one below from CVX, I notice the argument 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 it is, the output is a logical array of same size as 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

cvx_isaffine(M,1)

returns a 10x3 array with all elements are true .

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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