strncmp comparing two segments of the same string

1 Ansicht (letzte 30 Tage)
Shubhrajit Bhattacharjee
Shubhrajit Bhattacharjee am 5 Mär. 2020
Beantwortet: Image Analyst am 5 Mär. 2020
I have the following 2*1 cell array -
aa =
{'L['string',1]'}
{'L['string',2']}
I would like to do strncmp using 'L[' and ',1' characters so that the first cell result will show 1 and the second will show 0. I would appreciate any direction on this.

Akzeptierte Antwort

Image Analyst
Image Analyst am 5 Mär. 2020
Try contains(aa, 'L[') and contains(aa, '1'). Attach your aa in a .mat file if you need more help.

Weitere Antworten (0)

Kategorien

Mehr zu Characters and Strings 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