I have a matrix, for example:
А = [1 2 3 3 3 4 4 5 6]
And I want to remove duplicate numbers along with the number itself, so that another matrix will turn out:
Б = [1 2 5 6]
Actually code:
A = [1 2 3 3 3 4 4 5 6] n = unique(A) for i = n id = ismember(A, i); if sum(id) > 1 A(id) = []; end end A
Result:
A = 1 2 3 3 3 4 4 5 6 n = 1 2 3 4 5 6 A = 1 2 5 6
Source: https://ru.stackoverflow.com/questions/720159/More articles:How to get from Firebase the number of child elements of the (child) database?Get information about the manufacturer of RAMDressing iterators or generatorsProblems with the virtual environmentAlgorithm of using jwt in microservice architectureAttributeError: 'module' object has no attribute 'base_prefix' when getting an EXE file from Python 2.7 using cxFreeze 5.0.2What algorithm to use to build the file directory?SQL arithmetic subtractionHow to make img captcha image not be cropped and not go beyond the divJson list output from objectAll Articles