简体   繁体   中英

Octave integer matrix

I'm not able to create an integer matrix using Octave in my cpp code. I'm using the following code-

intNDArray< octave_int<short> > matrix_int8 =intNDArray(iRows,iCols);
for (r=0;r<iRows;r++)
{
  for(c=0;c<iCols;c++)
  {
    matrix_int8(r,c)=(pcData[r]+c);  
  }
}

I get the following error-

error: missing template arguments before '(' token 
intNDArray< octave_int<short> > matrix_int8 =intNDArray(iRows,iCols);

Is this the right way to create an integer matrix? How should I declare an integer matrix?

You need to specify template parameters after intNDArray in assignment.

intNDArray< octave_int<short> > matrix_int8 =intNDArray< octave_int<short> >(iRows,iCols);

Alternatively, you could just write:

intNDArray< octave_int<short> > matrix_int8(iRows,iCols);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM