搜索
Hello,
I am setting up a home energy monitoring system, all started from a blank sheet in arduino and its really working very well.
I would like to send data to thinkspeak which is not time dependant, i.e. send the X and Y values and format as a bar graph. The reason is, i have 12 channels monitoring energy (Wh) and i have this in an array which i plot on a local LCD and throughout the day the bars grow in height as the usage attributed to that channel grows. How can i do something similar in thing speak which by default applies a time stamp to received data.
Very simply, each channel has an ID (0-11) and a number associated with the accumulative Wh. I have a similar thing in excel for development where my serial port data is saved to a csv which excell imports every minute and updates a bar graph a bit like this;

Ive had a good look (perhaps not good enough!) and i just cant see how this may be acheived with thingspeak without a clumbersome combination of 2 channels (given each channel has 8 fields) and then using a matlab visualisation to pull it all together. Perhaps its not has hard / messy as it sounds? I am paid user so can create extra channels if required.
Thanks,
Stuart
I am facing an issue in data store memory block using store memory Read and write Block in matlab simulink. I have attached the screen short in which the posed error has been depicted.


How do i collect data from a website like weather.com and use it in a channel? I need the current weather on a specific location (including storms, hail etc.) but i couldn't find a way to do it.
Congratulations, @the cyclist for winning the Editor's Pick badge awarded for MATLAB Answers, in recognition of your awesome solution in Center of gaussian mixed distribution area.
Thank you for going to great lengths to help a user in this thread. It appears you downloaded the academic paper and read parts of it to figure out how to help the user.
This is a new badge we just introduced to recognize awesome answers people contribute and yours was picked for discovering a creative way to solve the problem, and made the solution clear, and reproducible. Thank you so much for setting a high standard for MATLAB Answers and for your ongoing contribution to the community.
MATLAB Central Team
You provided 37,574 anwers and received 11,750 votes. You are ranked #2 in the community, Thank you for your contribution to the community!
MATLAB Central Team
Connection: close
<html>
<head><title>400 Bad Request</title></head>
<body>
<center><h1>400 Bad Request</h1></center>
</body>
</html>
CLOSED
Word (Crossword , Wordle, etc.)
19%
Numerical (Sudoku, math, etc.)
33%
Brain teaser, logic
27%
Jigsaw, picture, finding/matching
9%
Wooden, metal, or other mechanical
10%
Other type (comment below)
2%
4398 个投票
Hello,
I have a dfrobot microbit environment science extension board labelled as (v3.0)
I have tried to publish data to my thingspeak channel. All is well configurated in thingspeak.
I have read the tutorial and unfortunately I'm not able to publish any data on the channel with the extension board...
I've tried manualy with my firefox browser “https://api.thingspeak.com/update?api_key=xxxxxxxxxxxxxx&field1=0” and it works fine
But in the makecode program it does'nt …
My program looks like this, what is wrong ???
Any help will be much appreciated and by the way sorry for my bad english

%This is the code. I have to introduce a small value, for example, e = 0.01
%and the loop has to stop when de difference in absolue value between a1
%and pi is less than that quantity. But it never stops and i dont know why.
%Hope you can help me. I appreciate it.
function [a1,a2,i,j] = ejercicio06(e)
i=2;
j=2;
p(1) = e+1;
s(1) = e+1;
while p(i-1) > e
a1 = (1./((4.*i+1).*(4.*i+3)));
a1=8*sum(a1);
p(i) = abs(a1-pi);
i = i+1;
end
disp('hola este bucle se ha terminado')
while s(j-1) > e
a2 = (1./(1+j).^2);
a2 = sqrt(6*sum(a2));
s(j) = abs(a2-pi);
j = j+1;
end
end
Hello. I want to send the data that I have collected from the sensors and that is displayed on ThingSpeak to a databse in Firebase. How can I do it? I know I can use the REST API but where should I code the fetch? Thanks.
With the release of MATLAB R2023a, we also are giving you early access to the new MATLAB Desktop. This includes Dark Mode! Download via Add-on Explorer in MATLAB or find here on File Exchange.
These are some of the many enhancements and new features of the new desktop:
- Dark mode / theme support - Change the colors of the desktop by selecting a dark theme.
- Updated layout - Quickly access tools and change your layout using the sidebar.
- Expanded search capabilities - Easily find actions, settings, and resources using the new universal search box.
- Figure toolstrip - Use the new figure toolstrip to easily modify annotations, text, and line styles, and view generated code.
- Keyboard and screen reader accessibility support - Use a screen reader to interact with the Command Window, Editor and desktop tools.
- Enhanced MATLAB Projects workflows - Collaborate using an improved user interface, manage multiple repositories using the Branch Manager, and investigate project hierarchies using the new Dependency Analyzer view.

Have fun trying it out and let us know what you think!
Congratulations, @DGM for winning the Editor's Pick badge awarded for MATLAB Answers, in recognition of your awesome solution in searching for a line of pixels in an image.
Thank you for a very detailed explanation of your solution with a lot of references and working code, providing rationale for why you prefer to use spline.
This is a new badge we just introduced to recognize awesome answers people contribute and yours was picked for discovering a creative way to solve the problem, and made the solution clear, and reproducible. Thank you so much for setting a high standard for MATLAB Answers and for your ongoing contribution to the community.
MATLAB Central Team
I can upload an image using postman. But when I try it with my rpi the image never shows. I receive status code 202. Then the current image from postman goes blank. Tells me the post sort of worked... Does anyone have working python3 code that they can share?
Last update is Friday March 10th. It appears from this end that the WS is correctly sending data.
If I can get Arduino running again I will try recompiling the code and update the board.
Hello people,
I made a program to read a dataset from JSON and make an API request to Thingspeak (bulk_write).
After the transmission I display the response of the request, which is 202 (compliant data).
My data updates fine on my Thingspeak channel but the longitude and latitude fields do not change.
Do you have any explanation for this problem?
Here is the code:
import json
import requests
import time
apiKey = "xxxxxxxxxxxxxxxx"
channel_ID = "xxxxxxx"
url = "https://api.thingspeak.com/channels/" + channel_ID + "/bulk_update.json" # ThingSpeak server settings
message_buffer = []
message = {}
while True:
f = open("data.json", "r")
jsonContent = f.read()
objJson = json.loads(jsonContent)
message['delta_t'] = 15
message['field1'] = (objJson['GPS']['speed'])
message['field2'] = (objJson['GROVE'][3]['degNord'])
message['field3'] = (objJson['GIROUETTE']['degVent'])
message['latitude'] = str((objJson['GPS']['latitude']))
message['longitude'] = str((objJson['GPS']['longitude']))
message['elevation'] = 100
latitude = (objJson['GPS']['latitude'])
longitude = (objJson['GPS']['longitude'])
#print(latitude)
#print(longitude)
message_buffer.append(message)
bulk_data = json.dumps({'write_api_key':apiKey,'updates':message_buffer})
print(bulk_data)
message_buffer = []
request_headers = {"User-Agent":"mw.doc.bulk-update","Content-Type":"application/json","Content-Length":str(len(bulk_data))}
print(request_headers)
response = requests.post(url,headers=request_headers,data=bulk_data)
print (response) # Response 200 : Validated data / Response 429 : Too many request, please wait
print("_________________________________________")
print()
time.sleep(15)
My JSON file :
{
"GPS": {
"latitude": 48.75607,
"longitude": 2.30202,
"speed": 10.04384
},
"GROVE": [
{
"Compas": {
"x": 2.583,
"y": -4.439,
"z": 0.435
}
},
{
"Gyroscope": {
"x": 2.56433,
"y": -4.45352,
"z": 0.47237
}
},
{
"Acceleration": {
"x": 0.28,
"y": 0.01,
"z": 0.93
}
},
{
"degNord": 20.743
}
],
"GIROUETTE": {
"degVent": 30.46389
}
}
Congratulations, @John D'Errico for winning the Editor's Pick badge awarded for MATLAB Answers, in recognition of your awesome solution in Finding linear combination of two vectors such as every element is positive.
Thank you for providing a very detailed and elegant discussion about an interesting math question, both fun and instructional.
This is a new badge we just introduced to recognize awesome answers people contribute and yours was picked for discovering a creative way to solve the problem, and made the solution clear, and reproducible. Thank you so much for setting a high standard for MATLAB Answers and for your ongoing contribution to the community.
MATLAB Central Team
In our community poll ‘Which MathWorks resource is most helpful to you while learning MATLAB?’, Documentation is listed as the most helpful resource by 47% of respondents. However, it’s also worth noting that there is tons of information in the documentation. When you want to learn a topic or get quick reference, a cheat sheet would be very useful and save you time!
We’d like to share with you 9 MATLAB Cheat Sheets for Data Science and Machine Learning! These cheat sheets let you find just the right command for the most common tasks for your data science or machine learning projects.
- Automated Machine Learning (AutoML): automate difficult and iterative steps of your model building
- MATLAB Live Editor: create an executable notebook with live scripts
- Importing and Exporting Data: read and write data in many forms
- Preprocessing Time Series Data: store, merge, and clean multirate time series sensor data
- Machine Learning: discover patterns and build predictive models
- Deep Learning: create, train, and validate deep neural networks
- Text Analytics: preprocess, analyze, and model text data
- Problem-Based Optimization: solve optimization problems using a natural syntax
- Solver-Based Optimization: solve optimization problems using matrices and functions

Check it out and let us know your thoughts.

Why this kind of problem is showing everytime?
Below is my code which I wish can change the color for the visualization without refresh the page.
% Set your ThingSpeak channel and API keys
channelID = 2044216;
readAPIKey = '4SVDGTR02R02PFAD';
% Initialize variables
threshold = 0;
circleRadius = 6;
circleCenterX = 30;
circleCenterY = 40;
greenColor = [0 1 0];
redColor = [1 0 0];
% Create the circle visualization
figure('Position',[100 100 200 200]);
circle = rectangle('Position',[circleCenterX - circleRadius, circleCenterY - circleRadius, circleRadius*2, circleRadius*2],...
'Curvature',[1,1],'FaceColor',greenColor);
axis square;
axis off;
% Continuously update the circle color based on the ThingSpeak channel data
while true
% Read the latest value of field 2 from your ThingSpeak channel
fieldData = thingSpeakRead(channelID, 'ReadKey', readAPIKey, 'Fields', 2, 'NumPoints', 1);
% Update the circle color based on the value of field 2
if fieldData == threshold
circle.FaceColor = redColor;
else
circle.FaceColor = greenColor;
end
end