How to match two matrices based on two keys?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello everyone,
Kindly find the attached file. I would like to know how to match these matrices based on two keys rather than one key?
I tried this code and for only one key (time).
xCOL = {'DOY','UT','lat','long'};
yCOL = {'DOY','UT','pf_30Mev','pf_60Mev'};
for i = 1:length(X)
X = array2table(X,'VariableNames',xCOL);
Y = array2table(Y,'VariableNames',yCOL);
output = innerjoin(X,Y,'LeftKeys','UT','RightKeys','Hour');
writetable(output, 'Matched.xlsx', 'Sheet', i);
end
The 1st column represents the day of year (DOY) and the 2nd column represents the time in hours.
I want to find the rows at which both the day and time of X and Y are the same.
Can you please tell me how?
0 Kommentare
Antworten (1)
Hiro Yoshino
am 10 Jan. 2020
The script below worked for me where "DOY" and "UT" were used as keys:
load("matlab.mat");
xCOL = {'DOY','UT','lat','long'};
yCOL = {'DOY','UT','pf_30Mev','pf_60Mev'};
X = array2table(X,'VariableNames',xCOL);
Y = array2table(Y,'VariableNames',yCOL);
output = innerjoin(X, Y,'Keys',[1 2]);
0 Kommentare
Siehe auch
Kategorien
Mehr zu Data Type Identification 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!