필터 지우기
필터 지우기

error using the join function

조회 수: 6 (최근 30일)
Wesso
Wesso 2023년 8월 21일
편집: Stephen23 2023년 8월 21일
FinalData = join(All,M4,'Keys','ID','Year');
% I want to join All and M4 based on the common variables ID and Year. I want all columns of All and the additional columns of B when there is a match based on ID and Year. I am receiving an error :
Error using tabular/join Wrong number of arguments.
What went wrong?

답변 (2개)

Stephen23
Stephen23 2023년 8월 21일
편집: Stephen23 2023년 8월 21일
"What went wrong?"
You need to provide multiple key names as one input argument, not as two separate input arguments. This means simply providing the key names as character vectors in a cell array:
FinalData = join(All,M4,'Keys',{'ID','Year'});
% ^ ^
This is explained in the JOIN documentation:

Dyuman Joshi
Dyuman Joshi 2023년 8월 21일
The corrext syntax is -
FinalData = join(All,M4,'Keys',{'ID','Year'});
%or
FinalData = join(All,M4,'Keys',["ID","Year"]);
Refer to the documentation page of join for more information.
If after making this correction, you still get an error, please attach your code (using the paperclip button) and copy and paste the full error message (i.e. all of the red text)

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

태그

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by