Main Content

matlab::data::Reference>

Templated C++ class to get reference toSparseArray

Description

Use theReferenceclass to get a reference to aSparseArrayelement of a container object, such as a MATLAB®structure or cell array.

Class Details

Namespace:

matlab::data

Include:

SparseArrayRef.hpp

Template Parameters

T

Type of elements inSparseArray, specified asbool,double, orstd::complex.

Iterators

Begin Iterators

iterator begin()

const_iteratorbegin() const

const_iteratorcbegin() const

Returns

iterator

Iterator to beginning of array, specified asTypedIterator.

const_iterator

Iterator, specified asTypedIterator::type>.

Throws

None

End Iterators

iterator end()

const_iteratorend() const

const_iteratorcend() const

Returns

iterator

Iterator to beginning of array, specified asTypedIterator.

const_iterator

Iterator, specified asTypedIterator::type>.

Throws

None

Member Functions

getNumberOfNonZeroElements

size_t getNumberOfNonZeroElements() const
Description

Returns the number of nonzero elements in the array. Since sparse arrays only store nonzero elements, this method returns the actual array size. It is different from array dimensions that specify the full array size.

Returns

size_t

Number of nonzero elements in the array.

Throws

None

Version History

Introduced in R2017b