Problem 43181. Find index of a string in a cell array

Solution 1028327

Submitted on 23 Oct 2016 by jf86
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
x = {'twenty-one'; 'twenty-two'; 'twenty-three'; 'one'; 'two'; 'three'}; for i = 1:6 assert(isequal(cellfind(x{i}, x),i)) validatestring(x{cellfind(x{i}, x)}, {x{i}}) end

ans = twenty-one ans = twenty-two ans = twenty-three ans = one ans = two ans = three