From help-octave-request at bevo dot che dot wisc dot edu Thu Jan 29 10:12:47 2004 Subject: varargout form a DLD function From: Shai Ayal To: Help-Octave List Date: Fri, 30 Jan 2004 00:10:22 +0200 This is a multi-part message in MIME format. --------------000902040405060802040103 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Hi all, I am trying to return a variable number of arguments from a DLD function //------------------------------------------------- #include "oct.h" DEFUN_DLD (test_arg, args, nargout,"") { octave_value_list retval; for(int i=0;i<5;i++) retval(i)=i; nargout = 5; return retval; } //------------------------------------------------- however, I cannot recover these arguments at the command line: GNU Octave, version 2.1.50 (i686-pc-linux-gnu). octave:1> test_arg() ans = 0 octave:2> a{:}=test_arg() a = { [1,1] = 0 } octave:3> b=test_arg() b = 0 octave:4> [a,b,c]=test_arg() a = 0 b = 1 c = 2 Note that if I know the number of arguments I can get them as in line 4. but what if I don't know beforehand ? Is there something similar to varargin{:} for output arguments ? Shai --------------000902040405060802040103 Content-Type: text/x-vcard; charset=utf8; name="shaia.vcf" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="shaia.vcf" begin:vcard fn:Shai Ayal n:Ayal;Shai org:BioControl Medical adr:;;3 Geron St.;Yahud;;56100;Israel email;internet:shaia at biocontrol dot co dot il title:Scientific Project Manager tel;work:+972 3 6322126 ext 223 tel;fax:+972 3 6322125 x-mozilla-html:FALSE version:2.1 end:vcard --------------000902040405060802040103-- ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------