Mercurial > octave-nkf
view examples/addtwomatrices.cc @ 14136:20cb178716ee
Make nargin and nargout behave more like Matlab's (Bug #32700)
* ov-usr-fcn.cc: Include "ov-fcn-handle.h". (Fnargout, Fnargin)
nargout can be given a function handle as well as a string. Allow
nargout(fcn) works in the top level. Make inline functions always
return 1. Make anonymous functions always return -1. Make functions
with varargout optionally preceded by named outputs return
-(length_output_list_including_the_varargout).
author | Iain Murray <iain@iainmurray.net> |
---|---|
date | Mon, 02 Jan 2012 12:49:52 -0500 |
parents | 4295d634797d |
children | be41c30bcb44 |
line wrap: on
line source
#include <octave/oct.h> DEFUN_DLD (addtwomatrices, args, , "Add A to B") { int nargin = args.length (); if (nargin != 2) print_usage (); else { NDArray A = args(0).array_value (); NDArray B = args(1).array_value (); if (! error_state) return octave_value (A + B); } return octave_value_list (); }