MATLAB: Taking number out from the image name.

image processingMATLABparse filename

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

Best Answer

[d,name,ext] = fileparts(fn) ;
a = str2num(name) ;