Q:

Vectorize this:

0

if length(str1) ~= length(str2)

 outlog = false;

else

 outlog = true;

 for i=1:length(str1)

 if str1(i) ~= str2(i)

 outlog = false;

 end

 end

end

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

outlog % Just to display the value

outlog = strcmp(str1, str2)

OR:

outlog = all(str1 == str2)

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now