How to combine multiple text file into 1 excel file?

1 回表示 (過去 30 日間)
AdeYang
AdeYang 2013 年 5 月 10 日
The codes below gave me a folder (f) of nested cell arrays that are not of equal size, as such I was not able to write from there. I needed all the data to append into 1 sheet.
[filename folder] = uigetfile('*.txt', 'Please select data file', 'MultiSelect', 'on');
for n = 1:size(filename,2) directory = strcat (folder, filename{1,n});
fid = fopen(directory); data = testscan(fid, '%f%s%f%f%f%f%f%f%f%f%f%f%f', 'delimiter', '\t', 'headerlines',1);
fclose(fid);
a = regexp(filename, '_', 'split');
data1 = [a{1,n}{1,2} data];
if n>1 f = [f;data1];
else f = data1;
end
end
f =
'P1Blue' [1455x1 double] {1455x1 cell} [1455x1 double] [1455x1 double] ......
'P1Blue' [993x1 double] {993x1 cell} [993x1 double] [993x1 double] ......
..... and so on for 300 over files...

回答 (0 件)

カテゴリ

Help Center および File ExchangeSpreadsheets についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by