find in structure a certain string
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Leonardo Wayne
am 15 Apr. 2016
Kommentiert: Leonardo Wayne
am 18 Apr. 2016
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/161355/image.png)
raw is a cell.
I would like to find the identification number in the example which is 13161509800019, but I only want the cell that contains 1-2-3, as the cell below it contains a trailing 4-5-6. Also how can I do that for any number of identification numbers containing 1-2-3 column 1 excluding first row 'SERIAL'?
0 Kommentare
Akzeptierte Antwort
Azzi Abdelmalek
am 15 Apr. 2016
Bearbeitet: Azzi Abdelmalek
am 15 Apr. 2016
C={'serial';'123456 1-2-3';'1452145 4-5-6';'745841 3-2-4';'85471245 1-2-3'}
C=C(2:end);
idx=~cellfun(@isempty,regexp(C,'1-2-3'))
D=C(idx)
out=regexp(D,'.+(?=1-2-3)','match')
out=str2double([out{:}])
2 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Linear Model Identification 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!