Clear Filters
Clear Filters

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

3 views (last 30 days)
HI, I WANT TO DO THIS:
2021 ****
2022 ****
but it give me error
dateshift(c,'start','year')
>> class(c)
ans =
'timetable'

Answers (1)

Walter Roberson
Walter Roberson on 15 Aug 2023
Edited: Walter Roberson on 15 Aug 2023
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 Comments
piero
piero on 15 Aug 2023
Edited: piero on 15 Aug 2023
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 on 15 Aug 2023
i solve it
c1 = dateshift(b.Properties.RowTimes ,'end', 'month');
A=table;
A.Date=c1;
A.Prof=b.Profit;
thank you

Sign in to comment.

Categories

Find more on Tables in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!