|Subject:||Re: Assigning values to Octave matrix in C++ code|
|Date:||Sat, 8 Oct 2016 12:44:39 +0530|
On Fri, Oct 07, 2016 at 11:05:00 +0530, Shamika Mohanan wrote:
> I'm using Octave API in c++ code. I'm creating a double matrix and
> assigning values from a pointer to the matrix using for loops.
> Matrix matrix_double = Matrix (iRows,iCols);for (r=0;r<iRows;r++)
r+iRows*c]);Can you clarify, do you want to create a Matrix to wrap your existing
> I want to avoid using for loops as much as possible. I tried this-
> where pdblReal points to the matrix values. This didn't raise any errors
> while compiling, the values were not assigned to matrix_double matrix
> during execution.
> Is it possible to assign values to a double (and other data type) matrix
> using pointers? If yes, what did I do wrong?
buffer, such that no data is copied? Or do you want a constructor that
copies the entire array from your buffer into the new Matrix in a single
The former is not possible, Octave's array classes own their memory
representation and do not offer a way to wrap an Octave array around an
existing C++ array.
The latter is possible if you have an STL container like a std::array or
Do you have your code hosted somewhere publically so we can help you
with more direct references?
|[Prev in Thread]||Current Thread||[Next in Thread]|