MATLAB Answers

Taking number out from the image name.

3 views (last 30 days)
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

  0 Comments

Sign in to comment.

Accepted Answer

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

  1 Comment

Muhammad Farhan  Mughal
Muhammad Farhan Mughal on 18 May 2020
Thank you KSSV for your response.

Sign in to comment.

More Answers (0)

Products


Release

R2018b