Meging two tables with different numbers of Rows
17 ビュー (過去 30 日間)
古いコメントを表示
Hallo,
I have two tables with different rows numbers and the final goal is to export these Data in excel File by using the Function " writetable ".
The first table contains Data of Maxima and Minima (as in the Image down). The second Table contains the increment Values of Maxima and Minima, they are always less Values and less rows than the Max.-Min.
First thing i have transfered the Data to Table as follow :
MaxMin = table(DehnungMax,DehnungMin);
Ink = table(DehnunungMax_inkr,DehnunungMin_inkr);
The Problem by using the function " outer join " asking always for Key variables, but theoretically there is no key.
I am trying even if Possible to put the increment of each Maxima and Minima under them in the same Column but divide the both Values with Header. or Even beside each other okay also. as Follow :
Thank you very much for any Help or Suggestion.
0 件のコメント
採用された回答
Vilém Frynta
2022 年 11 月 29 日
編集済み: Vilém Frynta
2022 年 11 月 29 日
Try:
% Random data to work with
DMax = [1 2 3 4 5]';
DMin = [0.1 0.2 0.3 0.4 0.5]';
DMaxInk = [11 22 33 44]';
DMinInk = [0.11 0.22 0.33 0.44]';
% Create table and create columns DMax and DMin
T = table;
T.DMax = DMax;
T.DMin = DMin;
If this is just one-time thing and you do not wish to automate this process, you can match the lengths by adding empty values.
% Adding NaN values on the end
DMaxInk(end+1,1) = NaN;
DMinInk(end+1,1) = NaN;
% Create columns for DMaxInk and DMinInk
T.DMaxInk = DMaxInk;
T.DMinInk = DMinInk
% Save the table
writetable(T,"your_table_name.xlsx");
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Spreadsheets についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!