MATLAB: Horizontal concatenate a datetime structure to a table array

horizontal concatenationMATLAB

Hi I am trying to place a datetime array next to a table array
I am trying the follwing but getting an error.
Once they are concatenated I then wish to save as a text file..
tst=AUD_CAD.Date(1:length(table2array(AUD_CAD(2:end,2))));
mydates = datetime(tst,'InputFormat','yyyy-MM-dd''T''HH:mm:ss.SSSSSSSSSZ ',
'TimeZone','Europe/London','Format','yyyyMMddHHmmss ')
AUDCADn = horzcat(num2cell(mydates), table2array(AUD_CAD(2:end,2)));
Error using horzcat
Dimensions of arrays being concatenated are not consistent. Consider converting input
arrays to the same type before concatenating.
both structures are the same size.
The resulting tect file should look like the following.

Best Answer

I can't tell which data it is you're trying to piece together, but from the OrginalData.mat you posted in the previous Q? on dates, looks to me like all you have to do is something like
tAUD=array2table(datetime(GBP_USD.Date,'InputFormat','yyyy-MM-dd''T''HH:mm:ss.SSSSSSSSSZ', ...
'TimeZone','Europe/London','Format','yyyyMMddHHmmss'),'VariableNames',{'Date'}); % reformat the date
tAUD.Open=GBP_USD.Open; % save the desired variables
tAUD.Close=GBP_USD.Close; % from the existing to the new
tAUD=tAUD(2:end,:); % if you don't want the first record, get rid of it
Much like the other problem you posted very shortly after this, direct manipulation of the table object is FAR the simplest route generally...
Related Question