how to read the .c file contents from the browsed files by matlab code..?
Show older comments
I am supposed to write a program choose the folder and read the file contents.Inside the folder i will have different types of files.in that i want to read only the files which is having the end name as "_data.c" .
folder_name = uigetdir('','source_code')
folder_name =
C:\Users\tamil\Desktop\Source_code
i have selected the folder with matlab code.but how do i read the file..?
Answers (1)
dpb
on 17 May 2014
folder_name = uigetdir('','source_code');
c=dir(fullfile(folder_name,'*_data.c')); % return directory list of matching files
for i=1:length(c)
d=importdata(c(i).name);
% do what you need w/ the resulting cell array here
...
end
Categories
Find more on Spreadsheets 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!