How can i add data from multiple tables?

3 次查看(过去 30 天)
I have a data set of six tables containing energy production.
They contain 2 rows and different number of columns.
Row 1 contains dates with different starting points, row 2 contains production values.
I have imported 6 tables, and added the range command to align the dates, as they have the same ending point.
They look like this.
V = readtable('Valsneset2006.xlsx','Range','A4:B4783');
S = readtable('Skomakerfjellet2016.xlsx','Range','A4:B4783');
The S matrix has over 3000 empty cells before it lines up with V, but i can't seem to find a better way to aling them.
I want to add the production numbers in row 2 of the different tables to view the total energy production each day.
How can i achieve this?
Thanks in advance!
  1 个评论
dpb
dpb 2021-3-6
编辑:dpb 2021-3-6
See <timetable.synchronize>. Also look at the "See Also" section for more on the general problem of cleaning up time series data. In short, don't try to physically align the data by location by hand; read in the data available and work on it in memory with the tools provided by MATLAB.

请先登录,再进行评论。

回答(1 个)

Aashita Dutta
Aashita Dutta 2022-1-25
As per my understanding, you are trying to read multiple tables and unable to align these tables due to empty cells in the matrix.
There are a couple of ways to resolve this issue. You can use the rmmissing’ function in Matlab that removes missing entries from the table.
T = readtable('Skomakerfjellet2016.xlsx','Range','A4:B4783');
T1 = rmmissing(T);
You can also use detectImportOptions function that create import options based on file content with MissingRuleproperty to manage missing data.
opts = detectImportOptions(' Skomakerfjellet2016.xlsx ');
opts.MissingRule = 'omitrow';

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

产品


版本

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by