MATLAB: Unable to read .mat files from a folder

.mat filereading from a folder

I have multiple .mat files in the a folder. I want to read each of the files and compare its data with one of the file of the same folder.
In line 6 I expected the path of the .mat file to be displayed. What was expected is C:\Users\Toshiba\Desktop\friday work\1_1_1.mat, C:\Users\Toshiba\Desktop\friday work\1_1_2 and so on for each file, instead i got C:\Users\Toshiba\Desktop\friday work\. , C:\Users\Toshiba\Desktop\friday work\..
The code I used is:
f_s = 'C:\Users\Toshiba\Desktop\friday work\';
f_s_2 = 'C:\Users\Toshiba\Desktop\friday work\1_1_2.mat';
ss = dir(f_s);
for i = 1:1:size(ss, 1)
im_nm = strcat(f_s, ss(i).name);
disp(im_nm);
end
I am unable to read the .mat file in the folder

Best Answer

Use
im_nm = fullfile(f_s, ss(i).name)
and keep in mind that when you dir() on a folder, you get everything in the folder, including all the directory links such as "." and ".." . To eliminate those
ss = dir(f_s);
ss([ss.isdir]) = [];