Append values in a new column
古いコメントを表示
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
回答 (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 件のコメント
Ioannis Doumanis
2021 年 12 月 7 日
Ioannis Doumanis
2021 年 12 月 7 日
編集済み: Ioannis Doumanis
2021 年 12 月 7 日
Cris LaPierre
2021 年 12 月 8 日
I'm not sure I understand what your code is doing. Why do you assign the result of readtable to a cell array, but them vertically concatenate x?
The assignment to specific rows of a variable in a table is easy enough to do
bigtable.Delay(1:6000) = 10;
Ioannis Doumanis
2021 年 12 月 8 日
Cris LaPierre
2021 年 12 月 20 日
Consider sharing your data files. You can attach them using the paperclip icon.
Ioannis Doumanis
2021 年 12 月 8 日
カテゴリ
ヘルプ センター および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!