I have a 20 x 2 cell. Both columns contains strings. What I would like to do is search for a string in column two and where the value in column 2 matches my search string to return the value in column 1. Please see my example below - I believe it will make things clearer.
name region ABC USA ASD EU PLKDD EU ERT EU LKK ASIA MNN USA WER EU
The result I would like based on the search string being "EU" is below
result ASD PLKDD ERT WERAnswer1:
You can try <a href="http://www.mathworks.se/help/matlab/ref/ismember.html" rel="nofollow">
x = 'ABC' 'USA' 'ASD' 'EU' 'PLKDD' 'EU' 'ERT' 'EU' 'LKK' 'ASIA' 'MNN' 'USA' 'WER' 'EU' y = x(find(ismember(x(:,2), 'EU')),1) y = 'ASD' 'PLKDD' 'ERT' 'WER'