Plot suddenly not working | 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
Plot suddenly not working
No permission to create posts
October 30, 2017
8:01 pm
Avatar
lboucher
New Member
Members
Forum Posts: 4
Member Since:
October 22, 2017
sp_UserOfflineSmall Offline

Hi All

I had the below code working a week ago, and now that I finally got my setup deployed, its not working.

The marker only lines work, but the lines (AKA (:,1) and (:,3)) don't show at all, however its clear that the scaling is correct for the actual data.

What gives?

https://thingspeak.com/apps/matlab_visualizations/180907

 

Thanks

 

readChannelID = [];
% TODO - Replace the [] with the Field ID to read data from:
fieldIDs = [1,2,3,4];

% Channel Read API Key
% If your channel is private, then enter the read API
% Key between the '' below:
readAPIKey = '';

%% Read Data %%

%%[data, time] = thingSpeakRead(readChannelID, 'Field', fieldID1, 'NumPoints', 30, 'ReadKey', readAPIKey);
[TempData,timeStamps] = thingSpeakRead(readChannelID,'fields',fieldIDs,'NumDays',7,'ReadKey',readAPIKey);

%% Visualize Data %%

 

plot(timeStamps,TempData(:,1));
hold on
plot(timeStamps,TempData(:,2),'rX','MarkerSize',10);
hold on
plot(timeStamps,TempData(:,3),'g');
hold on
plot(timeStamps,TempData(:,4),'k+','MarkerSize',10);
xlabel('Time')
ylabel('Temperature')
legend({'Well Temp','Power Loss Min Well Temp','Outside Temp','Power Loss Min Outside Temp'})
grid('on')
title('Cabin Temp - Last Week')
hold off

October 31, 2017
7:23 am
Avatar
cstapels
Moderator
Members


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

My guess is it is the data you are reading.  

I tried your code with some made up data and I see all the lines.  Have a look at each series individually- make sure there aren't NAN's or missing points or text data.

timeStamps=100:200; TempData(:,1)=1:101; TempData(:,2)=201:301; TempData(:,3)=301:401; TempData(:,4)=401:501;
plot(timeStamps,TempData(:,1));
hold on
plot(timeStamps,TempData(:,2),'rX','MarkerSize',10);
hold on
plot(timeStamps,TempData(:,3),'g');
hold on
plot(timeStamps,TempData(:,4),'k+','MarkerSize',10);
xlabel('Time')
ylabel('Temperature')
legend({'Well Temp','Power Loss Min Well Temp','Outside Temp','Power Loss Min Outside Temp'})
grid('on')
title('Cabin Temp - Last Week')
hold off

Forum Timezone: America/New_York

Most Users Ever Online: 114

Currently Online: samdavies
15 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:

Lakshmanaprakash S B, bettetj60, ronnievw3, bessiesj18, Pavan kumar, Williampup

Administrators: Hans: 387, lee: 457