How can I export the below table?

6 vues (au cours des 30 derniers jours)
Dame Chyrm
Dame Chyrm le 7 Fév 2021
Modifié(e) : Adam Danz le 9 Fév 2021
How can I export the below table?
Data = load('INPUTFILEedit.mat');
DataName = fieldnames(Data);
for k = 1:numel(DataName)
ThisName = DataName{k};
ThisData = Data.(ThisName);
tst=ThisData.Date(1:height(ThisData(2:end,2))); % just a sample set to play with
mydates = datetime(tst,'InputFormat','yyyy-MM-dd''T''HH:mm:ss.SSSSSSSSSZ ', ...
'TimeZone','Europe/London','Format','y-MM')
% size(AUDCAD)

Réponses (1)

Adam Danz
Adam Danz le 7 Fév 2021
Modifié(e) : Adam Danz le 9 Fév 2021
  1. Use readtable to read in the data as table T.
  2. Use the conversion below.
  3. Write to csv using writetable
T = array2table(reshape(1:18,3,[])', 'VariableNames',{'a' 'b' 'c'},'RowNames', compose('%d',0:5))
T = 6x3 table
a b c __ __ __ 0 1 2 3 1 4 5 6 2 7 8 9 3 10 11 12 4 13 14 15 5 16 17 18
T2 = array2table([reshape(T{1:3,:},1,[]); reshape(T{4:6,:},1,[])], ...
'VariableNames', strcat(repelem(T.Properties.VariableNames,1,3), 's', compose('%d',repmat(1:3,1,3))), ...
'RowNames', {'1','2'})
T2 = 2x9 table
as1 as2 as3 bs1 bs2 bs3 cs1 cs2 cs3 ___ ___ ___ ___ ___ ___ ___ ___ ___ 1 1 4 7 2 5 8 3 6 9 2 10 13 16 11 14 17 12 15 18

Community Treasure Hunt

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

Start Hunting!

Translated by