I have a cell array that looks like the following:
Tickerarray =
'MNST' 'MNST' 'MNST' 'ALGN' 'ALGN'
'GRA' 'VLO' 'GRA' 'SKS' 'SKS'
'VLO' 'GRA' 'SKS' 'TSO' 'JDSU'
'TSO' 'TSO' 'TSO' 'VLO' 'TSO'
Given a certain column of this cell array, I need to find for each entry the most distant (to the right) consecutive column that contains that entry. For example, given the first column of this cell array, I would want an output:
'3'
'3'
'2' % even though VLO appears in column 4, it does not appear consecutively
'5'
Given column 3 as input, I would want as output:
'1'
'1'
'3'
'3'