MATLAB: Number of unequal elements in a matrix

MATLABunequal elements

How to find total number of unequal elements in a single matrix or array? For example, A=[1 2 3 4 4 3], in total this array has 6 elements but 3, 4 appears twice, we need to consider it once, so the total number of elements should be like 4. The equal elements should be considered once.

Best Answer

unique(A)