I understand you are aiming to utilize the time efficiency of binary search on a cell array of characters or strings by using MATLAB's built-in functions, specifically the ‘ismembc’ or ‘ismembc2’ helper functions associated with ‘ismember’.
However, these helper functions are designed to work exclusively with numeric, logical, or character arrays and to my knowledge, ‘ismember’ handles cell arrays of strings differently, which is why they are failing and ‘ismember’ is not in this context.
When dealing only with cell arrays of characters, the cell array can be converted into a character array, allowing the use of ‘ismembc’, as a workaround. For example,
charArray = cell2mat(cellArray)
Unfortunately, I can’t think of a similar workaround for string arrays.
Alternatively, there are toolboxes for binary search online, which I think can be leveraged for your use case, instead of creating a custom function from scratch.
Hope this helps!