Incorrect number or types of inputs or outputs for function 'dateshift'.

3 次查看(过去 30 天)
HI, I WANT TO DO THIS:
2021 ****
2022 ****
but it give me error
dateshift(c,'start','year')
>> class(c)
ans =
'timetable'

回答(1 个)

Walter Roberson
Walter Roberson 2023-8-15
编辑:Walter Roberson 2023-8-15
Do you actually need to change the time entries, or do you just need to have them display as years?
Changing the time entries could give challenges if it ended up with duplicate row times.
If you just want to change the display then,
c.Properties.RowTimes.Format = 'uuuu';
If you need to change the actual times then
c.Properties.RowTimes = dateshift(c.Properties.RowTimes, 'start', 'year');
Note that shifting to the start of the year is not enough to change the display to be just year.
  3 个评论
piero
piero 2023-8-15
编辑:piero 2023-8-15
thanks correct...in the table of year i solve with problem with : c.Properties.RowTimes.Format = 'uuuu';
instead in the array of months I want to change it like this
from
01-Jan-2022 -3908.5
01-Feb-2022 10274.5
01-Mar-2022 10496.75
01-Apr-2022 12027.25
01-May-2022 6304.5
to
31-01-2022 xxx
20-02-2022 xxx
i try code:
c1 = dateshift(c1.Properties.RowTimes, 'start', 'month');
but i don't see any difference
piero
piero 2023-8-15
i solve it
c1 = dateshift(b.Properties.RowTimes ,'end', 'month');
A=table;
A.Date=c1;
A.Prof=b.Profit;
thank you

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Tables 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by