From help-octave-request at bevo dot che dot wisc dot edu Tue Jan 11 23:26:05 2000 Subject: Rows in DLD functions From: "John W. Eaton" To: bsapp at lanl dot gov Cc: help-octave at bevo dot che dot wisc dot edu Date: Tue, 11 Jan 2000 23:27:04 -0600 (CST) On 11-Jan-2000, Ben Sapp wrote: | Can any one tell me why the following DLD function prints a row vector | but returns a column vector? I think it should print and return a | column vector. Can you also tell me how I can return a Row vector | instead of a column vector? | | rowvec_test.cc | ------------------------------------------------------------------- | #include | #include | | DEFUN_DLD(rowvec_test,args, , "\nRow vector test\n"){ | | RowVector the_row = args(0).vector_value(); | octave_stdout << "The Row vector = \n" << the_row << "\n"; | return octave_value(the_row); | } | ------------------------------------------------------------------- | | Run it from octave like this: | | v = [ 1 2 3]; | rowvec_test(v) I think this is a design bug, but it was not too hard to fix, so in the current CVS sources (and soon in the next bleeding-edge tar file), you can write #include #include DEFUN_DLD (rowvec_test, args, , "Row vector test") { RowVector the_row = args(0).row_vector_value(); octave_stdout << "The Row vector = \n" << the_row << "\n"; return the_row; } and have it do what you probably expect. jwe ----------------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.che.wisc.edu/octave/octave.html How to fund new projects: http://www.che.wisc.edu/octave/funding.html Subscription information: http://www.che.wisc.edu/octave/archive.html -----------------------------------------------------------------------