How to join/merge all sub tables into 1 table?
1 次查看(过去 30 天)
显示 更早的评论
Hi;
i have a table (S1) and it contains 4041 tables into. Sub tables are all text. I want to merge them to a single table or cell. I don't know how to merge them..
(all tables have text data)
4 个评论
Guillaume
2018-3-26
That new problem is easily fixed. But at the same time, we can fix the import so that it's the right format directly. The simplest thing would be for you to show your import code.
采纳的回答
Guillaume
2018-3-26
编辑:Guillaume
2018-3-26
[~,SheetNames] = xlsfinfo('a.xlsx');
nSheets = numel(SheetNames);
SheetContents = cell(size(SheetNames));
for iSheet = 1:nSheets
Name = SheetNames{iSheet};
SheetContents{iSheet} = readtable('a.xlsx','Sheet',Name, 'ReadVariableNames', false);
end
SheetContents = vertcat(SheetContents{:});
2 个评论
Guillaume
2018-3-26
The code lists the table numbers
That bit is your own code and is the output of xlsfinfo that is displayed because you didn't end the line with a semicolon.
As for the error, that's a simple typo. I wrote sheetNames instead of SheetNames.
I've fixed both issues.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Annotations 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!