Find duplicated values in a row and rename
Show older comments
I have a data array (100:500), and for the first vector(1,:) I would like to find the duplicated string values(the data in each cell is an string). For the result duplicated stings found I want to concatenate '_2'...'_n' depending on the duplicates found. I have try with the unique and histc functions but since is a vector of strings I could not achieve a good result.
I would really appreciate some help,
Thanks in advance
Accepted Answer
More Answers (1)
A K
on 16 Jul 2013
0 votes
You can try using "unique" function to get a listing of all unique strings in your row vector
Next try using "strmatch" for each uniqe string found to see if they are repeated. You can try
index = strmatch('unique_string', array_of_strings, 'exact'), where index will point to the locations in array_of_strings where unique_string occurs.
1 Comment
Manuel
on 17 Jul 2013
Categories
Find more on Data Type Conversion in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!