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

1 Ansicht (letzte 30 Tage)
cell = {'a','a','b','b','c','c'}
function (cell, 'a') returns 2
function (cell, 'b') returns 4
function (cell, 'c') returns 6

Akzeptierte Antwort

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

Weitere Antworten (0)

Kategorien

Mehr zu Data Types finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by