Function [b,ihf,irb,icb] = strcmpvh(v,h,matchmode,mindcase)
compares each string in cell-array of strings, v, with
each string in cell-array of strings, h, and returns a
matrix of booleans b.
Element b(iv,ih) is true, if string v{iv} is equal to
string h{ih}. Otherwise, it is false.
If the input argument matchmode is zero, the total
lengths of v{iv} and h{ih} are compared to each other.
If matchmode is -1, the first n characters of h{ih} are
compared to v{iv}, with n = length(v{iv}).
If matchmode is +1, the first n characters of v{iv} are
compared to h{ih}, with n = length(h{ih}).
At default, matchmode is 0.
If the input argument mindcase is true, the case of
alphabetic characters is significant. Otherwise, the
difference between upper and lower case of alphabetic
characters is disregarded.
At default, mindcase is 0.
The third and fourth input arguments are optional. The
default value is also applied, if the argument is given as
an empty matrix [].
The output argument ihf contains a column vector of
indices, which has the same number of rows as b. If
ihf(iv) > 0, then b(iv,:) contains at least one true
value, and then ihf(iv) is the first of the series of
indices to h, for which a match with v{iv} is found. If
ihf(iv) == 0, then v{iv} does not match to any of the
strings in h.
The output arguments irb and icb contain a column vector
of indices iv an ih for which matches were found. So, for
each match im, v{irb(im)} and h{icb(im)} are found to be
equal to each other.
(c) 2026 fabien van mook
2026.08.20 release of this file within package "fvm-optionmanip" under GNU GPLv3+