Function 'webread' not supported for code generation Matlab - ThingSpeak - Raspberry Pi
Afficher commentaires plus anciens
Hello everybody!
I need to use a Raspberry Pi that get data from a ThingSpeak channel in a standalone configuration, but the problem is that functions ThingSpeakRead and webread are not supported. What can I do?
direccion=['https://api.thingspeak.com/channels/' chId '/feeds.json?api_key=' Read '&results=' cPoints];
datos=webread(direccion);
Function 'webread' not supported for code generation
Réponse acceptée
Plus de réponses (2)
Denis Gurchenkov
le 29 Juin 2021
2 votes
Yes, you are right, webread() does not support code generation. As a workaround, you can use coder.ceval functon to call a hand-written C function that opens the connection, reads and decodes the data, and returns the data back to MATLAB code. It is a bit complicated : you would need to maintain two branches in your MATLAB code, one for normal MATLAB execution, the other one for Raspberry Pi, and use coder.target to switch between those.
In order to impelment the C fucntion that does the http read, you can use one of the opensource free HTTP libraries that are available (libcurl is availalbe on raspberry pi?). An alternative is to just invoke curl using system() command. Would this approach work for you?
1 commentaire
Vinicio Moya
le 29 Juin 2021
1 commentaire
Vinicio Moya
le 27 Juin 2021
Communautés
Plus de réponses dans ThingSpeak Community
Catégories
En savoir plus sur ThingSpeak dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!