how can I loop inside a folder that has several files and put each inside a cell column.I tried the code below it retrieves the first file and places it inside several cell columns.how could I modify it so that it does it for each file instead?thanks
1 view (last 30 days)
Show older comments
Adrien Vertil
on 4 Jul 2015
Commented: Star Strider
on 4 Jul 2015
for k=1:numfiles
mydata{k}=File_path(k).name;
gendat=mydata{k};
gen=strcat(file_path,gendat);
fid=fopen(gen);
mydat{k}=textscan(fid,'%s','delimiter','\n');
mydat{k}=mydat{1,1};
final_data{k}=mydat{1,k}{1,1};
temp=final_data{k};
flag_1=temp{1};
Indx1=strfind(flag_1,'No');
if (~isempty(Indx1))
continue;
else
myfinal_data{k}=temp;
end
fclose(fid);
end
0 Comments
Accepted Answer
Star Strider
on 4 Jul 2015
I can’t run your code, so I can’t be certain, but it seems to me that one possible solution is to eliminate this line:
mydat{k}=mydat{1,1};
It seems that would overwrite every subsequent file read by assigning the first cell to all of them.
More Answers (0)
See Also
Categories
Find more on Audio and Video Data 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!