Maths with Months | MATLAB IoT Analytics | Forum

Avatar

Please consider registering
Guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —






— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed sp_TopicIcon
Maths with Months
No permission to create posts
August 12, 2019
6:24 am
Avatar
obod0002

Silver
Members
Forum Posts: 19
Member Since:
March 13, 2019
sp_UserOfflineSmall Offline

I'm facing an issue which I can't get solved:
to plot my graphs I'm using something like

voltageWeek1 = thingSpeakRead(readChannelID,'Fields',voltageFieldID,'dateRange',...
[datetime('now')-days(7),datetime('now')],'ReadKey',readAPIKey,...
'Outputformat','Timetable');

So I thought, what's working with days, should do so with months as well ...

voltageMonth1 = thingSpeakRead(readChannelID,'Fields',voltageFieldID,'dateRange',...
[datestr(prevMonth1),datetime('now')],'ReadKey',readAPIKey,...
'Outputformat','Timetable');
is okay when setting
d = datenum(date);
prevMonth1 = addtodate(datenum(date), -1, 'month');

But
voltageMonth2 = thingSpeakRead(readChannelID,'Fields',voltageFieldID,'dateRange',...
[datestr(prevMonth2), datestr(prevMonth1)],'ReadKey',readAPIKey,...
'Outputformat','Timetable');
doesn't do, even with the two initializations
d = datenum(date);
prevMonth1 = addtodate(datenum(date), -1, 'month');
prevMonth2 = addtodate(datenum(date), -2, 'month');

Would be great if you could help

August 21, 2019
11:18 am
Avatar
cstapels
Moderator
Members


Moderators
Forum Posts: 754
Member Since:
March 7, 2017
sp_UserOfflineSmall Offline

how about
voltageWeek1 = thingSpeakRead(readChannelID,'Fields',voltageFieldID,'dateRange',...
[datetime('now')-month(1),datetime('now')],'ReadKey',readAPIKey,...
'Outputformat','Timetable');

Forum Timezone: America/New_York

Most Users Ever Online: 166

Currently Online:
28 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

rw950431: 272

Vinod: 240

piajola: 95

turgo: 70

vespapierre: 63

Adarsh_Murthy: 62

Member Stats:

Guest Posters: 1

Members: 8665

Moderators: 1

Admins: 2

Forum Stats:

Groups: 3

Forums: 14

Topics: 1600

Posts: 5760

Newest Members:

Fathima22, jefflam1994, harrydawson, markpaul7931, sgarsvk2rdx, Win Win

Moderators: cstapels: 460

Administrators: Hans: 405, lee: 457