help-octave
[Top][All Lists]
Advanced

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

Assigning values to Octave matrix in C++ code


From: Shamika Mohanan
Subject: Assigning values to Octave matrix in C++ code
Date: Fri, 7 Oct 2016 11:05:00 +0530

Hello,

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++)
                {
                    for(c=0;c<iCols;c++)
                    {
                        matrix_double(r,c)=(pdblReal[r+iRows*c]);

                    }
                }

I want to avoid using for loops as much as possible. I tried this-

matrix_double(*pdblReal,iRows,iCols);

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?

This question was listed here also-http://stackoverflow.com/questions/39879458/assigning-values-to-octave-matrix-in-c-code

Regards,

Shamika


reply via email to

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