Merge a large number of tables with different lengths aligned by specific column variable

조회 수: 2 (최근 30일)
I have a spreadsheet that was imported using the following code:
filename = 'Baseline ROI analysis SOMA.xlsx'; %identify name of the file
sheets = sheetnames(filename); %load string of sheet names
disp(sheets)
raw_data = [] %initialize
%loop through and load each sheet into a raw_data (cell format)
for k = 1:length(sheets)
raw_data{k} = readtable(filename,'Sheet',sheets(k));
end
The 1x20 cell contains 20 tables with 6 column variables per table.
I manually extracted each table to a variable, removing 3 variables that I do not need. (I assume there's a faster way to do this, but I can only think of dynamic variable names which I believe are frowned upon).
Example:
data1 = removevars(raw_data{1,1},{'Name','ND_M','ND_Z'})
data2 = removevars(raw_data{1,2},{'Name','ND_M','ND_Z'})
data3 = removevars(raw_data{1,3},{'Name','ND_M','ND_Z'})
The remaining variables - time(Time_s_), video frame #(ND_T), and average intensity(x_1_470Nm_) are output into the individual tables.
I've tried using outerjoins, but since I can't set an index (like a pandas dataframe), I can't merge on the frame values.
testmerge = outerjoin(data1,data2)
Is there a way to merge the tables so that all values are retained, and they can be aligned by frame #?
Also, would there be a way to do so without chaining outerjoin(data1,outerjoin(data2,outerjoin(data3,outerjoin(data4,data5))))... ?
Thanks in advance!

답변 (0개)

카테고리

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

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by