help-octave
[Top][All Lists]
Advanced

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

Re: creating an matrix from C++ array


From: Jaroslav Hajek
Subject: Re: creating an matrix from C++ array
Date: Sat, 4 Apr 2009 09:23:45 +0200

On Sat, Apr 4, 2009 at 8:31 AM, Martijn <address@hidden> wrote:
> Hi,
> I would like to create an octave matrix (of uint16) from an C++ array,
> but there is apparently no constructor that accepts this:
>
>        unsigned a[11];
>        for(int i=0; i<11; i++)
>        {       a[i]=i;
>        }
>        uint16NDArray A(a,11);
>
> Do I have to loop over all elements or is there a quicker way?
> I want to used such construction to read a lot of uint16 data from a
> file into an C++ array of unsigned shorts. Then I would like to create
> an octave uint16NDArray from the array.
>

In short, no, there's no such constructor. If you want to avoid
copying the elements, use uint16NDArray to manage your data from the
very start.

regards

-- 
RNDr. Jaroslav Hajek
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz



reply via email to

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