Misha
Misha

Reputation: 377

Complex matrix in octave

I'm using Octave in my cpp code to perform matrix manipulations. Sample code is given below:

Matrix matr = Matrix (5,4);
for (int r=0;r<5;r++)
{
     for(int c=0;c<4;c++)
     {
         matr(r,c)=(r+c);
     }
} 

How do I declare a complex 2D matrix and pass both real and imaginary values to the matrix?

Upvotes: 1

Views: 773

Answers (1)

Andy
Andy

Reputation: 8091

#include <CMatrix.h>
...
ComplexMatrix matr = ComplexMatrix (5,4);
...
matr (r,c) = complex (r, c);
...

Upvotes: 2

Related Questions