Meging two tables with different numbers of Rows
17 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
khaled elbatawy
am 29 Nov. 2022
Bearbeitet: Vilém Frynta
am 29 Nov. 2022
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 Kommentare
Akzeptierte Antwort
Vilém Frynta
am 29 Nov. 2022
Bearbeitet: Vilém Frynta
am 29 Nov. 2022
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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Spreadsheets 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!