File Exchange

image thumbnail


version 1.0.0 (9.27 KB) by Pruthvi G
To find the duplicate Values(String) in the Cell array List


Updated 08 Jul 2019

View License

% Name : Get_Duplicate_array_with_Index
% Author : Pruthvi Raj G - KPIT_RNTBCI :: (9677066394 :: )
% Version : Version 1.0 - 2011b Compactible
% Description : To find the duplicate Values(String) in the Cell array List.
% Input : Cell Array List
% Date : 08-April-2019
[Duplicate_Names, Duplicate_Index] = Get_Duplicate_array_with_Index(Cell_Array_list)

Example :

>> Array = [{'raj'},{'krish'},{'raj'},{'king'}];
>> [Duplicate_Names, Duplicate_Index] = Get_Duplicate_array_with_Index(Array)

Duplicate_Names =


Duplicate_Index =

[1x2 double] = 1 3

Cite As

Pruthvi G (2021). Get_Duplicate_array_with_Index (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (2)

David Walwark

ismember() won't give multiple locations, so for some situations you would probably have to loop over strcmp(). Forget all that, just use this function right here and enjoy life.

Jim Tonti

Get_Duplicate_array_with_Index() may be the perfect complement to the unique() function, and a surprisingly complex procedure. Raj has made a significant contribution to our community (and just in time for my project) by creating this function that exactly identifies duplicate/duplicated entries.
I use it to locate duplicate data capture files differing by only a timestamp. (Mask off the timestamp, run through Raj's function, then pick the correct duplicated file by using the returned index.) Thank you!

MATLAB Release Compatibility
Created with R2011b
Compatible with R2011b to R2019a
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!