MATLAB: How to find data from an imported array that matches a user request

arrayfindinputMATLAB

So I want to import a data array from excel. The array could be something like:
Car 1
Canoe 2
Football 3
Foosball 4
Now lets say the user requests Canoe. I need the function to look for 'Canoe' in the left hand row and then output the value that corresponds to?
I've tried find(strcmp but its not working for me and I'm kind of at a loss. Thanks in advance.

Best Answer

The strcmp (or related strcmpi) function will return a logical value or array that you can use to index into the matching numerical array.
Example —
A = {'Car' 1
'Canoe' 2
'Football' 3
'Foosball' 4};
Choose = 'canoe';
Out = A{strcmpi(A(:,1),Choose), 2}
produces:
Out =
2