MATLAB: Str2double gives NAN

nanstr2double

Hi,
I would like to do this with the attached string array.
CombinedStim(:,2)==k
It is impossible that CombinedStim is string, whereas k is a double.
I tried to use str2double and got NAN values because the first column contains strings, whereas second column is numbers.
Then i try regexp, however I was not succesfull again.
Is there any way I can make this work?
Thank you

Best Answer

What about only converting second column to double
str2double(CombinedStim(:,2)) == k
Or using num2str and then use strcmp()
strcmp(CombinedStim(:,2), num2str(2))