Append values in a new column
35 次查看(过去 30 天)
显示 更早的评论
Hello all
The code below overwrites the previous values in the column Delay and inserts only the last ones (20). There should be a way to append the array instead of overwriting it but I dont know how. Any help will be appreciated
if contains(baseFileName,"A01")
x{k} = readtable(fullFileName,opts)
bigtable = vertcat(x{:})
bigtable(:,'Delay') = {10}
elseif contains(baseFileName,"A02")
x{k} = readtable(fullFileName,opts)
bigtable = vertcat(x{:})
bigtable(:,'Delay') = {20}
end
0 个评论
回答(2 个)
Cris LaPierre
2021-12-7
If your tables have the same variable names (order does not matter), then just use square brackets.
newTable = readtable(fullFileName,opts)
bigtable = [bigtable;newTable];
5 个评论
Cris LaPierre
2021-12-20
Consider sharing your data files. You can attach them using the paperclip icon.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!