Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

CNiMatrix: how to use them

I tried to use CniVector and CNiMatrix objects in my application.
As for the first one, at some stage the compiler tries to compile CniVector.idl and says it cannot due to some error in the code. As for the CNiMatrix, I have gotr problems with the bare use of them. The manual says that given an object of this class, let's say M, I shoud access elements using M(i,j). The compiler says that for that operator there are 8 overloads (I guess it is the number of different types of CNiScalarMatrix available). Might be I should cast my double variable to a proper type before assigning to M(i,j)? Might be the data type of i and j that is wrong (I use long)?
0 Kudos
Message 1 of 3
(3,065 Views)
I'm not sure how familiar you are with these classes yet. CNiMatrix and CNiVector are abstract base classes. CNiMatrixT and CNiVectorT are the templates for those classes. These four classes are not intended to be used directly as objects, but provide the foundation for the type specific data types like CNiReal64Vector and CNiReal64Matrix. See the information in posted response to a similar question here for more information.

Best Regards,

Chris Matthews
National Instruments
0 Kudos
Message 2 of 3
(3,065 Views)
Are you trying to use the CNiVector and CNiMatrix classes directly or are you using one of the type definitions derived from these classes like CNiReal64Vector or CNiReal64Matrix? In general, you should use the CNiReal64Vector and CNiReal64Matrix classes (or one of the other typedefs, see this article for more information). If you are using a CNiReal64Matrix, you should be able to assign a double to it using long indexers (i.e. "M(i,j)=d" where i and j are longs and d is a double).

If this does not solve your problem, please post the errors that you are getting and the code that is causing the
problem.

Tony
Measurement Studio
Message 3 of 3
(3,065 Views)