Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

Matlab Unique function in Fortran

hoseinkalaei
Beginner
1,029 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,029 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