필터 지우기
필터 지우기

Mergin matrixes with multiple identifiers

조회 수: 2 (최근 30일)
Oskar Lund
Oskar Lund 2020년 10월 23일
댓글: Peter Perkins 2020년 11월 20일
Hi
I have two (or several matrices), which are datasets with an identifier for year and company, and then they have different data. One of the matrix have more data on each unique year and firm, and the other only has one observation for each year and firm, and some year / firm can be represented in only one of the matrixes.
So i need to link these matrixes together, so the year/firm that is not represented in both matrices are removed, and if there is more observations in matrix A with same year/firm it will have the data from matrix B repeated each time that year / firm is represented in matrix A.
Is there any function that can do this or do i have to run through alot of loops / if statements or what's the approach?
If needed i can provide the data :-)
Best regards,
Oskar

채택된 답변

Ankriti Sachan
Ankriti Sachan 2020년 10월 29일
Based on my understanding, you can do the following:
  1. Convert the matrices to the tables - https://www.mathworks.com/help/matlab/ref/array2table.html.
  2. Perform 'join' operation on the tables - https://www.mathworks.com/help/matlab/ref/table.join.html.
If this does not help, please provide an example to help me understand the query better.
  댓글 수: 1
Peter Perkins
Peter Perkins 2020년 11월 20일
It sounds like this would specificaly be innerjoin.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by