Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Matlab Unique function in Fortran

hoseinkalaei
Beginner
1,022 Views
I am looking for a FORTRAN subroutine or function equivalent to the "unique" functions in MATLAB.
Any help is appreciated.
0 Kudos
1 Reply
Steven_L_Intel1
Employee
1,022 Views
There isn't a direct equivalent in Fortran. In Matlab, UNIQUE(A) returns an array of the unique elements in A, in sorted order. I think to implement this in Fortran you'd first have to sort the array, construct a mask that deselects duplicate elements and then does a PACK to select only the unique elements.
0 Kudos
Reply