Plot suddenly not working | MATLAB | Forum

Avatar

Please consider registering
Guest

Search

— Forum Scope —






— Match —





— Forum Options —





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

Register Lost password?
sp_Feed sp_TopicIcon
Plot suddenly not working
Avatar
lboucher
New Member
Forum Posts: 4
sp_UserOfflineSmall Offline
1
October 30, 2017 - 8:01 pm
sp_Permalink sp_Print

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

Avatar
cstapels

Gold
Forum Posts: 122
sp_UserOnlineSmall Online
2
October 31, 2017 - 7:23 am
sp_Permalink sp_Print

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: cstapels
24 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

rw950431: 252

Vinod: 164

cstapels: 96

piajola: 75

vespapierre: 63

Adarsh_Murthy: 59

Newest Members:

yeseniara11

RomanFug

JamesPes

RobertBak

ScottSmiva

Amourhotte

Forum Stats:

Groups: 4

Forums: 17

Topics: 1313

Posts: 4565

 

Member Stats:

Guest Posters: 1

Members: 5703

Moderators: 0

Admins: 2

Administrators: Hans, lee