Unknown File/Folder in directory
Show older comments
HI, I'm one of the enw users of Matlab.
I'm Having some problem in folder and sub folder reading......
Look at this Code....
Name = '.\train20X20\'
Main_File = dir(fullfile(Name));
Normal access to a folder, but this folder has 34 sub folder in it but when I compile this line, on the (Workspace) Tab the variable Main_File shows that there are 36 folders in it.

What does this mean, I dont Understand.
In the Main folder there are 34 subfolders having 10 images each. what is wrong.
after that when i try to make a loop to access the subfolder using there names it shows an error message.

I tried bothg with Curly Brackets and Small Brackets but the same message appeared.
Few Monthes Earliar i worked on something similar, the function worked perfectly but this time it's not working i dont know what wrong.

1 Comment
The simple way to ignore the '.' and '..' folders:
S = dir(Folder_Name);
S = S(~ismember({d.name},{'.','..'}));
Accepted Answer
More Answers (0)
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!