MATLAB: Delete rows from cell array

cell arrays

i have a cell array with string as below (format is "number""space""-""space""number")
1234 - 5678
543 - 2345
5678 - 1234
delete the numbers relations such as
1234 - 5678
5678 - 1234
and keep first one of them and get output as
1234 - 5678
543 - 2345
i need to search using '-'
i get empty matrix, when i do as below
index = find(ismember(cellArr(1), ' - '))

Best Answer

I'm assuming that you want to delete repeated pairs regardless of the order the numbers appear in the pair.
Possibly the easiest way would be:
c = {'1234 - 5678';
'543 - 2345';
'5678 - 1234';}
[~, urows] = unique(regexprep(c, '([^- ]*) - ([^-]*)', '${strjoin(sort({$1, $2}), '' - '')}'), 'stable');
filteredc = c(urows)