Error in extract_db (line 47) file_a = extractAfter(char(file_a), 0, strfind(char(file_a), '_')-2);
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Balaji M. Sontakke
am 21 Nov. 2018
Kommentiert: Balaji M. Sontakke
am 22 Nov. 2018
'101_1.tif' '101_2.tif' '101_3.tif' '101_4.tif' '101_5.tif' '101_6.tif' '101_7.tif' '101_8.tif' '102_1.tif' '102_2.tif' '102_3.tif' '102_4.tif' '102_5.tif' '102_6.tif' '102_7.tif' '102_8.tif' '103_1.tif' '103_2.tif' '103_3.tif' '103_4.tif' '103_5.tif' '103_6.tif' '103_7.tif' '103_8.tif' '104_1.tif' '104_2.tif' '104_3.tif' '104_4.tif' '104_5.tif' '104_6.tif' '104_7.tif' '104_8.tif' '105_1.tif' '105_2.tif' '105_3.tif' '105_4.tif' '105_5.tif' '105_6.tif' '105_7.tif' '105_8.tif' '106_1.tif' '106_2.tif' '106_3.tif' '106_4.tif' '106_5.tif' '106_6.tif' '106_7.tif' '106_8.tif' '107_1.tif' '107_2.tif' '107_3.tif' '107_4.tif' '107_5.tif' '107_6.tif' '107_7.tif' '107_8.tif' '108_1.tif' '108_2.tif' '108_3.tif' '108_4.tif' '108_5.tif' '108_6.tif' '108_7.tif' '108_8.tif' '109_1.tif' '109_2.tif' '109_3.tif' '109_4.tif' '109_5.tif' '109_6.tif' '109_7.tif' '109_8.tif' '110_1.tif' '110_2.tif' '110_3.tif' '110_4.tif' '110_5.tif' '110_6.tif' '110_7.tif' '110_8.tif'
I have the Img names "101_1",
and I want to extract the substring
included between the underscore '_'.
Here I used,
file_a = extractAfter(char(file_a), 0, strfind(char(file_a), '_')-2);
but it produces error,
I want as output 102_1 and so on.
How can I do this? thanks
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 21 Nov. 2018
fileparts()
You do not indicate what the error is .I suspect you are using r2016a or earlier before extractAfter existed
6 Kommentare
Walter Roberson
am 21 Nov. 2018
file_a = regexprep(file_a, '\..*$', '');
This will work whether file_a is a cell array of character vectors or a single character vector -- in other words it can be applied to the complete list of filenames all at the same time.
Weitere Antworten (0)
Siehe auch
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!