error using the join function
    2 Ansichten (letzte 30 Tage)
  
       Ältere Kommentare anzeigen
    
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?
0 Kommentare
Antworten (2)
  Stephen23
      
      
 am 21 Aug. 2023
        
      Bearbeitet: Stephen23
      
      
 am 21 Aug. 2023
  
      "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:
0 Kommentare
  Dyuman Joshi
      
      
 am 21 Aug. 2023
        The corrext syntax is - 
FinalData = join(All,M4,'Keys',{'ID','Year'}); 
%or
FinalData = join(All,M4,'Keys',["ID","Year"]);
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)
0 Kommentare
Siehe auch
Kategorien
				Mehr zu Data Type Conversion finden Sie in Help Center und File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!