octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 1D NDArray -> octave_value


From: Teemu Ikonen
Subject: Re: 1D NDArray -> octave_value
Date: Thu, 14 Dec 2006 17:21:22 +0100

On 12/14/06, John W. Eaton <address@hidden> wrote:
It should not be possible to create 1-d vectors in Octave, so this may
be a bug.  Are you using the CVS sources?  Can you please post a short
example that shows precisely how a vector like this can be created?

Sorry, I sent the previous mail before it was ready. I'm using Octave
2.9.9 in Debian and here's a testcase. This produces a 10 element 1D
vector.

#include <octave/oct.h>


DEFUN_DLD(bug, args, nargout, "bug")
{
 dim_vector dv;
 octave_value retval;

 dv = dim_vector();
 dv.resize(1);
 dv.elem(0) = 10;
 NDArray y(dv);
 for(int i = 0; i < 10; i++) {
   y(i) = 1.0;
 }

 retval = octave_value(y).squeeze();
 return retval;

}


reply via email to

[Prev in Thread] Current Thread [Next in Thread]