Two methods to do this are containers.Map
and logical indexing
Logical indexing
firstly we will find the occurance of the input in the first column with strcmp
using ind=strcmp(pippo(:,1),'nimp')
and then get the contents of the cell in the second column where this is true pippo{ind,2}
which can be combined into one line with
out = pippo{strcmp(pippo(:,1),'nimp'),2}
containers.Map
using containers.Map
you can map the keys in the first column to the values in the second column this information is stored as a container, below this is the pippo2 variable
pippo2=containers.Map(pippo(:,1),pippo(:,2))
and then you can call the container with an argument of the key and get the value as output
out=pippo2('nimp')
out =
2