Code covered by the BSD License  

Highlights from
4D data exploration

image thumbnail

4D data exploration

by

 

09 Jan 2007 (Updated )

Navigate through 2D+time or 3D+time data through interactively linked cross-sections, time course pl

fn_ismemberstr(a,b)
function c = fn_ismemberstr(a,b)
% function c = fn_ismemberstr(a,b)
%---
% same as ismember(a,b), but much faster!!, for cell arrays of strings

% Thomas Deneux
% Copyright 2007-2012

if ~iscell(a)
    a = {a}; 
    if ~iscell(b)
        error('one of the two argument must be a cell array of strings, use ismember instead')
    end
elseif ~iscell(b)
    b = {b}; 
end

c = false(size(a));
for i=1:numel(a)
    ai = a(i);
    for j=1:numel(b)
        if strcmp(ai,b{j}), c(i)=true; break, end
    end
end

Contact us