MATLAB Answers

read number from file name leaving special characters

3 views (last 30 days)
Oindri
Oindri on 14 Mar 2018
Commented: KSSV on 14 Mar 2018
data_3dsar_pass1_az001_HH.mat
This is the filename. I need to read in the serial number at the end of the string. I have 360 such files starting from 001 to 360. how do i do it.

  0 Comments

Sign in to comment.

Accepted Answer

KSSV
KSSV on 14 Mar 2018
Edited: KSSV on 14 Mar 2018
matfiles = dir('*.mat') ; % you are in the folder of mat files
N = length(matfiles) ; % total number of files
% loop for each file
for i = 1:N
thisfile = matfiles(i).name
% do what you want
end

  4 Comments

Show 1 older comment
Oindri
Oindri on 14 Mar 2018
Thanks. Anyways, I had to make some modifications.

Sign in to comment.

More Answers (0)


Translated by