MATLAB: Result of strfind

str2funcstrings

Hi,
I'm using strfind function and I want to check the result of this function. However, when strfind doesn't find the string that I indicated and the result is {[]}, instead of the position value. I have tested the result of strfind with strcmp and == or ~= but I can't control the value.
How can I know whether value of strfind is {[]}?
Regards

Best Answer

a={[]}
isempty(a{:}) %1 if a is empty, 0 otherwise
another option
numel(a{:}) %0 if a is empty, it returns the number of elements of a
Related Question