I am having an issue using strcmp when there is a single string in my cell array
Show older comments
Hello all!
I am having an issue using strcmp and I was wondering if maybe someone could help. I have a vector called L that looks like:
L = {'Aja',[],[],[],[], ... []};
with 46 empty entries. Then I have a list of words called U that looks like:
U = {string1, string2, ... ,'Aja', ..., stringN};
so U is a unique list of strings and the word in position L{1} is for sure in U, where in my case U{88} = 'Aja'. However when I do
strcmp(L,U{88})
returns a vector of 47 zeros. The first entry should for sure be one. Then when I do
strcmp(L{1},U{88})
it returns a 1 as it should. Does anyone know why this is happening? I need to be able to return the correct vector,
v = [1, 0 ,0 , 0 ...., 0];
Thank you for your help in advance.
Accepted Answer
More Answers (0)
Categories
Find more on Cell Arrays in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!