1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| PathName = uigetdir;
d = dir(fullfile(PathName,'*.txt'));
A = cell(numel(d),1);
nLines = 0; delimiter = sprintf('\t');
for i = 1:numel(d)
% Identify the rows and columns of text settings file
fid = fopen(fullfile(PathName, d(i).name),'rt');
while (fgets(fid) ~= -1),
nLines = nLines+1;
end
fclose(fid);
fid = fopen(fullfile(PathName, d(i).name),'rt');
Lines = fgets(fid);
nCols = numel(strfind(Lines,delimiter)) + 1;
fclose(fid);
A{i} = dlmread(fullfile(PathName, d(i).name),'\t',2,1);
disp(['FILE ALLOCATION NUMBER:' num2str(i) ' IS COMPLETED...THE SIZE IS :' num2str([nLines nCols])]);
end |
Partager