28.12.2012 Views

Figure Properties - SERC

Figure Properties - SERC

Figure Properties - SERC

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

error(nargoutchk(2, 4, nargout, 'struct'))<br />

nargoutchk<br />

If nargoutchk detects no error, it returns an empty string or structure. When<br />

nargoutchk is used with the error function, as shown here, this empty string<br />

or structure is passed as an input to error. When error receives an empty<br />

string or structure, it simply returns and no error is generated.<br />

Examples You can use nargoutchk to determine if an M-file has been called with the<br />

correct number of output arguments. This example uses nargout to return the<br />

number of output arguments specified when the function was called. The<br />

function is designed to be called with one, two, or three output arguments. If<br />

called with no arguments or more than three arguments, nargoutchk returns<br />

an error message:<br />

function [s, varargout] = mysize(x)<br />

msg = nargoutchk(1, 3, nargout);<br />

if isempty(msg)<br />

nout = max(nargout, 1) - 1;<br />

s = size(x);<br />

for k = 1:nout, varargout(k) = {s(k)}; end<br />

else<br />

disp(msg)<br />

end<br />

See Also nargchk, nargout, nargin, varargout, varargin, error<br />

2-1517

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!