[Top][All Lists]

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

Re: Oct File Access Array Elements

From: Thomas D. Dean
Subject: Re: Oct File Access Array Elements
Date: Fri, 2 Aug 2019 22:06:31 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0

On 8/2/19 10:01 PM, Thomas D. Dean wrote:
I have an application that calls a C library function to get a list of
values.  These values are uint8_t.  The function call seems to work OK,
but, I am having problems getting the data back to octave.

    A = mufunc()

After reading the source code and the docs, I believe

     dim_vector dv(1, 2);
     dv(0) = 1;
     dv(1) = 2048;
     uint8NDArray out(dv);

is the best definition to do this.

The code that reads the device and returns values to octave is:

         OCTAVE_LOCAL_BUFFER (double, dev_dat, 2048)
         rc = read_dev(dev, dev_dat)
         copy data into out  --- how?
         return octave_value(out);

Again, it seems I hollered before I was hurt.  direct assignment works.

   out(idx) = dev_dat[idx]

reply via email to

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