Matlab Visualization with more than 8000 data points | MATLAB | 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
Matlab Visualization with more than 8000 data points
No permission to create posts
March 31, 2016
9:19 am
Avatar
skoogs
New Member
Members
Forum Posts: 1
Member Since:
March 31, 2016
sp_UserOfflineSmall Offline

I'm trying to visualize temperature logging data over a time span of days, which corresponds to more than 8000 data points at a 15 sec POST rate.

Since 'thingSpeakRead' won't get more than 8000 data points, I figured I can use more than one call and fetch one day worth of data per call, all in one Visualisation script.
Unfortunately, the scripts times out when i try to gather more than 3 days of data at a time.
Is there any way of getting data over longer periods of time? I don't even need all consecutive data points. Some kind of low-pass filtering would also be fine for me!

My example code:

readChannelID = [93093];
fieldID = [1 2 3 4 5 6];

% Compile 1 week of data
% Read last day. First day out of seven days
t0 = datetime('now');
noofdays = 3;
t = cell(noofdays,1);
for i=1:noofdays
% Set t(i) to represent exatly 'now' but i days ago
t{noofdays-i+1} = t0;
t{noofdays-i+1}.Day = t{noofdays-i+1}.Day-i+1;
end

% Fetch all data from TS
alldata = 0;
alltime = 0;
for i=1:(noofdays-1)
[data,time] = thingSpeakRead(readChannelID,'Fields',fieldID,'DateRange',[t{i},t{i+1}]);

% Merge data
if i==1
alldata = data;
alltime = time;
else
alldata = cat( 1, alldata, data );
alltime = cat( 1, alltime, time );
end
end

% Downsample data with 1/100
y = alldata(1:10:end,:);
x = alltime(1:10:end);

%% Visualize Data %%
figure(1)
plot(x, y);
xlabel('Time');
ylabel('Temperature °C');
title('Sensor values last week');
legend('A','B','C','D','E','F');

April 4, 2016
3:11 am
Avatar
rw950431

Top
Members
Forum Posts: 271
Member Since:
January 30, 2014
sp_UserOfflineSmall Offline

You can use the 'average' or 'median' modifiers to reduce the number of data points although thingspeak only supports a limited number of intervals see https://au.mathworks.com/help/thingspeak/get-a-channel-feed.html

Forum Timezone: America/New_York

Most Users Ever Online: 114

Currently Online:
28 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

rw950431: 261

Vinod: 196

piajola: 85

turgo: 70

vespapierre: 63

Adarsh_Murthy: 62

Member Stats:

Guest Posters: 1

Members: 5703

Moderators: 0

Admins: 2

Forum Stats:

Groups: 4

Forums: 17

Topics: 1313

Posts: 4565

Newest Members:

James181, kimberlypg2, JamesAdorb, waynesmith, paulettebw60, ashleytb4

Administrators: Hans: 387, lee: 457