Plot won't show line

2 ビュー (過去 30 日間)
Loraine Luceñara
Loraine Luceñara 2019 年 7 月 25 日
回答済み: Vinod 2019 年 7 月 25 日
I've been trying to plot a chart on thingspeak. but the line won't seem to appear. How do I make the line appear?
I've tried to change the line to a dashed line, I've also tried to varying the linewidth but all it got me were much bigger markers. I've checked and all the arrays right size. If it helps, the timestamps array is a datetime array.
Here is all of my code:
% Channel ID to read data from
readChannelID = 827912;
% Temperature Field ID
TemperatureFieldID = 1;
% Wind speed Field ID
HumidityFieldID = 4;
% Channel Read API Key
% If your channel is private, then enter the read API
% Key between the '' below:
readAPIKey = 'CZD7YSPVMXAAI188';
% Read Data. Learn more about the thingSpeakRead function by
% going to the Documentation tab on the right side pane of this page.
[data, timeStamps] = thingSpeakRead(readChannelID, 'Fields',[TemperatureFieldID HumidityFieldID], ...
'NumPoints', 300, ...
'ReadKey', readAPIKey);
% Extract the temperature data from the first column
temperatureData = data(:, 1);
% Extract the windspeed data from the second column
HumidityData = data(:, 2);
% Visualize Data
yyaxis left
plot(timeStamps, temperatureData,'mo-',...
'LineWidth',2,...
'MarkerEdgeColor','k',...
'MarkerFaceColor',[.49 1 .63],...
'MarkerSize',5);
ylabel('Temperature');
hold on;
yyaxis right
plot(timeStamps, HumidityData, '--mo',...
'LineWidth',2,...
'MarkerEdgeColor','k',...
'MarkerFaceColor','b',...
'MarkerSize',5);
ylabel('Humdity');

採用された回答

Vinod
Vinod 2019 年 7 月 25 日
My guess is that your data has a bunch of NaN's in it which is causing the issue.
Look at the documentation of the rmmissing and fillmissing functions in MATLAB as a way to remove or fill the missing points before plotting.

その他の回答 (0 件)

コミュニティ

その他の回答  ThingSpeak コミュニティ

カテゴリ

Help Center および File ExchangeVisualize Data についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by