If my understanding is correct, you are trying to extract numbers just after 'BUS'.
If so, how about the following?
str =...
{'OPEN BRANCH FROM BUS 459 TO BUS 496 CIRCUIT 1←';...
'REMOVE UNIT 1 FROM BUS 17←'};
data = regexp(str,'BUS\s+\d+','match');
for kk = 1:numel(data)
data{kk} = regexprep(data{kk},'BUS\s+','');
end
The result is:
>> data{1}
ans =
1×2 cell array
{'459'} {'496'}
>> data{2}
ans =
1×1 cell array
{'17'}
Best Answer