Taking number out from the image name.

2 次查看(过去 30 天)
In my MATLAB code i browse for images using uiget
[fn, pn] = uigetfile('*.jpg;*.tif');
the variable fn is the name of image '2034.jpg'
Is there a method to take the digit "2034" out an assign it to integer variable such as
a = 2034
Thank you

采纳的回答

KSSV
KSSV 2020-5-17
[d,name,ext] = fileparts(fn) ;
a = str2num(name) ;

更多回答(0 个)

产品


版本

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by