Are there any functions that will return the index of the last string in a cell of strings?

1 view (last 30 days)
cell = {'a','a','b','b','c','c'}
function (cell, 'a') returns 2
function (cell, 'b') returns 4
function (cell, 'c') returns 6

Accepted Answer

David Hill
David Hill on 1 Apr 2020
find(ismember(cell,'a'),1,'last');

More Answers (0)

Categories

Find more on Data Types in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!