How to assign values in multiple tables
1 回表示 (過去 30 日間)
古いコメントを表示
Hi,
In my workspace i have like hundreds of tables. Each table is for different depth value that various from 0 to 1000 in steps of 10. So what i want to do is i want to create 4 more columns in each table. For Example the column header name will be K, A, D ,S. And like the values of K, A, D and S is same for depths 0 to 200 and 210 to 500 its different values (but constant) and from 500 to 1000 its different but constant. How can i do this for all the tables by writing a small programme. I am attaching sample table files. Any help will be appreciated. Thanks in advance.
2 件のコメント
Stephen23
2020 年 3 月 17 日
"In my workspace i have like hundreds of tables."
That is the main problem.
When you import your data, allocate them to one array (e.g. cell array, table, structure, etc) using indexing (simple and efficient) or fieldnames. Then your task is trivial with one simple loop.
Peter Perkins
2020 年 4 月 14 日
You attached files, which suggests that maybe you have hundreds of files. If that's the case, then write a loop to read them into elements of a cell array, something like
c = cell(1,n);
for i = 1:n
c{i} = readtable('filename_i');
end
and then you at least have a chance.
So the three files you posted seem nothing like you description; they all have timestamps, and a constant depth value in each one. You need to explain more clearly what you want to do, with a small example.
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Tables についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!