Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

How to initialize a matrix?

Dear all,

I have a CNiUInt8Matrix, m_bufferDIMatrix that I want to initialize.

I tried this API, but I am getting an error because it is a protected member.

                   void Init( unsigned int rows, unsigned int cols )

Any tips, ideas how to initialize a matrix?  I am using cDAQ-9172 + MSVC++.

 

Thanks a bunch,

A

 

 

   

 

 

 

0 Kudos
Message 1 of 3
(6,872 Views)
Hello A,
 
We have two options to initialize this matrix.  One is to simply use the constructor, CNiMatrixT(), to set the size of the matrix. There is a constructor that takes in two parameters (rows, cols) to set the size, or another that takes in 3 elements to include a default value.  We can also change the size of an existing matrix using the SetSize() function.  This function allows us to (re)set the size of the matrix and initialize 'new' members (members that exist beyond the size of the original array).  Using one of these two methods I think you should be able to properly create your matrix.
John B.
Applications Engineer
National Instruments
Message 2 of 3
(6,840 Views)

Thanks John for the enlightenment.  I tried and it worked. !!!! Smiley Happy

 

0 Kudos
Message 3 of 3
(6,831 Views)