'ismember' for cell arrays with various data types

Version 1.1 (2.11 KB) by Wei-Rong Chen
'cellismember' is a function that performs 'ismember' on cell arrays with various data types
205 Downloads
Updated 16 Apr 2015

View License

The built-in "ismember" function in MATLAB fails to perform when the input variables are cells containing different types of variables.
% This function 'cellismember' is a function that performs 'ismember' on
% cells with various data types.
% The input A and B must be cell arrays.
% Example:
% Input: A = {'ab','cd', NaN, [], 5, 1}; B = {[], 'cd', NaN, 1};
% output: Lia = [0 1 1 1 0 1];
%
% Acknowledgement:
% This function greatly benefits from Jan Simon's comments. The previous version was errorful.
% See 'ismember' for more information
% Weirong Chen Apr-16-2015

Cite As

Wei-Rong Chen (2024). 'ismember' for cell arrays with various data types (https://www.mathworks.com/matlabcentral/fileexchange/50474-ismember-for-cell-arrays-with-various-data-types), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2012a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.1

Bug fixed.

1.0.0.0