Hi all,I am using an recursive program to list out all c files inside a directory which contains folders and subfolders through recursion but i m getting out of memory issue,Can anybody suggest me ?? I think i need a terminating condition in for loop

1 view (last 30 days)
function search() Directory='C:\Users\Admin\Downloads'; [NeuronFileList]=findAllNeuronFiles(Directory); function NeuronFileList=findAllNeuronFiles(Directory)
NeuronFileList=dir(fullfile(Directory,'*.c'));
ListSubFold=dir(Directory); ListSubFold=ListSubFold([ListSubFold(:).isdir]);
for i=1:numel(ListSubFold) if ~strcmp(ListSubFold(i).name,'.') ~strcmp(ListSubFold(i).name,'..') NeuronFileList=[NeuronFileList;findAllNeuronFiles(fullfile(Directory,ListSubFold(i).name))]; end end
end end

Answers (0)

Categories

Find more on Startup and Shutdown 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!