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: John W. Eaton
Subject: Re: creating an matrix from C++ array
Date: Sat, 4 Apr 2009 17:06:51 -0400

On  4-Apr-2009, John Swensen wrote:

| Matrix m1(settings.width, settings.height);
| uint8NDArray m = octave_value(m1).uint8_array_value();
| octave_uint8* tmp = m.fortran_vec();
| memcpy( tmp, capturebuffer, settings.height*settings.width );
| return octave_value(m.transpose());

I think you can skip the part that creates the Matrix as an
octave_value and write this instead:

  uint8NDArray m (dim_vector (nr, nc));
  octave_uint8 *tmp = m.fortran_vec ();
  ...

jwe


reply via email to

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