This code snippet
A = table2array(testdates);
is unclear. It seems you are reading a spreadsheet into a table, getting a one-var table from that, converting that to the raw data, converting that to datetime, and plotting.
For one thing, this seems simpler:
A = Data.SomeVarName(5834:end);
I guess the first var in your table is, what, text timestamps? That's the only way I can make sense of datetime(A). In which case, I'd suggest working with a timetable, something like this:
tt = table2timetable(Data(:,2:end),'RowTimes',datetime(Data.SomeVarName))
I also have no idea what else is in Data, or indeed where target_test is coming from. It would seem logical that target_test would be extracted from Data.
So OK, you have a datetime and you plot you target_test against that, and you get a nice plot. But it seems like you are wanting to have a plot against some kind of elapsed time. I don't know where, say, 200 comes from. Maybe it's a number of elapsed days since ... something? They don't seem to be row numbers.
Try subtracting your origin datetime from A, and setting the resulting duration's format to 'd'.