필터 지우기
필터 지우기

How can i add data from multiple tables?

조회 수: 5 (최근 30일)
Oscar Rogneby
Oscar Rogneby 2021년 3월 6일
답변: Aashita Dutta 2022년 1월 25일
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에서 Text Files에 대해 자세히 알아보기

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by