Taking number out from the image name.

1 vue (au cours des 30 derniers jours)
Muhammad Farhan  Mughal
Muhammad Farhan Mughal le 17 Mai 2020
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

Réponse acceptée

KSSV
KSSV le 17 Mai 2020
[d,name,ext] = fileparts(fn) ;
a = str2num(name) ;
  1 commentaire
Muhammad Farhan  Mughal
Muhammad Farhan Mughal le 18 Mai 2020
Thank you KSSV for your response.

Connectez-vous pour commenter.

Plus de réponses (0)

Produits


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by