Mi He2 in MATLAB Answers
上次活动时间: 2025-5-18

Over the past few days, I’ve observed that MATLAB visualizations on ThingSpeak are not rendering correctly when accessed via the public URL. When I run the MATLAB Visualization script manually within ThingSpeak, the resulting image has the correct resolution and aspect ratios. However, accessing the same visualization through the public URL generates a much smaller image with distorted proportions. The script itself hasn’t been modified for a long time, and this issue has only started occurring recently. Could this be related to a recent change in the rendering engine or visualization settings on ThingSpeak? I would appreciate any guidance or insight into what might be causing this discrepancy. Thank you!
Marc Capafons Garcia in MATLAB Answers
上次活动时间: 2020-4-13

Hello! I am trying to create a 3d graph of these that have to be displayed and we got this error when I try to save and execute the matlab code ... I attach the error, the complete matlab code and the web from where the information was taken. Website of the information: https://es.mathworks.com/matlabcentral/mlc-downloads/downloads/submissions/56910/versions/4/previews/html/ThingSpeakWeatherStation.html#2 Graph I want to create: Matlab code: % Channel ID to read data from readChannelID = 803557; % Specify date range dateRange = [datetime('March 7, 2016'),datetime('March 13, 2016')]; % Read data including the timestamp, and channel information. [data,time,channelInfo] = thingSpeakRead(readChannelID,'Fields',1:7,... 'DateRange',dateRange); % Create variables to store different sorts of data temperatureData = data(:,1); humidityData = data(:,2); pressureData = data(:,3); rainData = data(:,4); windSpeedData = data(:,5); windGustData = data(:,6); windDirectionData = data(:,7); % Create a day range vector dayRange = day(dateRange(1):dateRange(2)); % Pre-allocate matrix weatherData = zeros(length(dayRange),24); % Generate temperature 3D bar chart % Get temperature per whole clock for each day for m = 1:length(dayRange) % Loop over all days for n = 1:24 % Loop over 24 hours if any(day(time)==dayRange(m) & hour(time)==n); % Check if data exist for this specific time hourlyData = temperatureData((day(time)==dayRange(m) & hour(time)==n)); % Pull out the hourly temperature from the matrix weatherData(m,n) = hourlyData(1); % Assign the temperature at the time closest to the whole clock end end end % Plot figure h = bar3(datenum(dateRange(1):dateRange(2)), weatherData); for k = 1:length(h) % Change the face color for each bar h(k).CData = h(k).ZData; h(k).FaceColor = 'interp'; end title('Temperature Distribution') xlabel('Hour of Day') ylabel('Date') datetick('y','mmm dd') % Change the Y-Tick to display specified date format ax = gca; ax.XTick = 1:24; % Change the X-Tick to 24 hours ax.YTickLabelRotation = 30; % Rotate label for better display colorbar % Add a color bar to indicate the scaling of color % Generate humidity 3D bar chart % Get humidity per whole clock for each day for m = 1:length(dayRange) % Loop over all days for n = 1:24 % Loop over 24 hours if any(day(time)==dayRange(m) & hour(time)==n); % Check if data exist for this specific time hourlyData = humidityData((day(time)==dayRange(m) & hour(time)==n)); % Pull out the hourly humidity from the matrix weatherData(m,n) = hourlyData(1); % Assign the humidity at the time closest to the whole clock end end end % Plot figure h = bar3(datenum(dateRange(1):dateRange(2)), weatherData); for k = 1:length(h) % Change the face color for each bar h(k).CData = h(k).ZData; h(k).FaceColor = 'interp'; end title('Humidity Distribution') xlabel('Hour of Day') ylabel('Date') datetick('y','mmm dd') % Change the Y-Tick to display specified date format ax = gca; ax.XTick = 1:24; % Change the X-Tick to 24 hours ax.YTickLabelRotation = 30; % Rotate label for better display colorbar % Add a color bar to indicate the scaling of color Error we said: I would really appreciate your help. Thanks. Marc
grishma dabhi in MATLAB Answers
上次活动时间: 2019-10-21

i am uploading a code for mq135 gas sensor and node mcu. But the graph is not displayed in Thingspeak.any one can help please?the code is here #include<ThingSpeak.h> #include <WiFiClient.h>; #include <SPI.h> #include "MQ135.h" #include <ESP8266WiFi.h> const char *apiKey = "1CUJEV41WNM7WHHP"; // Enter your Write API key from ThingSpeak const char *ssid = "Harrin"; // replace with your wifi ssid and wpa2 key const char *pass = "harrin20"; const char* server = "api.thingspeak.com"; WiFiClient client; unsigned long myChannelNumber = 876579; byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED}; #define VOLTAGE_MAX 5.0 #define VOLTAGE_MAXCOUNTS 1023.0 void setup() { Serial.begin(9600); delay(10); Serial.println("Connecting to "); Serial.println(ssid); WiFi.begin(ssid, pass); ThingSpeak.begin(client); } void loop() { // read the input on analog pin 0: int sensorValue = analogRead(A0); // Convert the analog reading // On Arduino: 0 - 1023 maps to 0 - 5 volts // On ESP8266: 0 - 1023 maps to 0 - 1 volts // On Particle: 0 - 4095 maps to 0 - 3.3 volts float voltage = sensorValue * (VOLTAGE_MAX / VOLTAGE_MAXCOUNTS); Serial.print(voltage); Serial.println(); delay(10000); // ThingSpeak will only accept updates every 15 seconds ThingSpeak.writeField(myChannelNumber, 1,voltage, apiKey); //Update in ThingSpeak delay (100);

关于 ThingSpeak

The community for students, researchers, and engineers looking to use MATLAB, Simulink, and ThingSpeak for Internet of Things applications. You can find the latest ThingSpeak news, tutorials to jump-start your next IoT project, and a forum to engage in a discussion on your latest cloud-based project. You can see answers to problems other users have solved and share how you solved a problem.