Using the C++ Math Library    

Array Size

In MATLAB, the size() function returns the size of an array as an array. The MATLAB C++ Math Library provides a corresponding version of size() that also returns an array. Because this C++ version allocates an array to hold just two integers, it is not efficient. The mwArray Size member functions below return the size of an array more efficiently.

An array (a matrix is a special case) has two sizes: the number of its dimensions (for matrices, always two) and the actual size of each dimension. You can use these Size() functions to determine both the number of dimensions and the size of each dimension:

For example, this code demonstrates the difference in efficiency between one of the mwArray Size member functions and the nonmember function.


 Operators Extracting Data from an mwArray