user1936752
user1936752

Reputation: 858

Use of 'full' in MATLAB function arguments

In some libraries, e.g. 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

Upvotes: 1

Views: 29

Answers (1)

Cris Luengo
Cris Luengo

Reputation: 60760

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.

Upvotes: 2

Related Questions