MATLAB: Cell array value based on poisiton

cell arrays

Hi,
I have created following code, It's basically based on input text search it in S array and returns poistion
S ={'a' 'b' 'c' 'd' 'e'; 'f' 'g' 'h' 'i' 'j'; 'k' 'l' 'm' 'n' 'o'; 'p' 'r' 's' 't' 'u'; 'v' 'w' 'x' 'y' 'z'}
Q=input('Enter the input text: ')
find(ismember(S, Q)==1)
Lets say input text is 'e' so output will be 21, Now i want to return 21th element from K array that is 't'
K={ 'g' 'm' 'r' 'i' 't'; 'a' 'b' 'c' 'd' 'e'; 'f' 'h' 'j' 'k' 'l'; 'n' 'o' 'p' 's' 'u'; 'v' 'w' 'x' 'y' 'z'}
How to retrive cell array value based on position. Pls guide me..
Thanks in Advance

Best Answer

foundIndex = find(ismember(S, Q)==1)
K{foundIndex}