Ubidots Community

send data from ubidots to matlab

how to send data uploaded to ubidots to matlab?

Good day @DIEGO21

Thank you for sharing your question with the community.

Please refer to the below article to learn about the integration of MATLAB with Ubidots. This article will help you to know how to use MATLAB to send data to Ubidots using the “webwrite” function. If what you want to do is to send Data from Ubidots to MATLAB, there should be a “webread” (although I’m not well versed in MATLAB) function too.

If instead you’d like something like a native Matlab MQTT client, it seems like this feature is tied up and restricted to only work with Mathwork’s IoT Platform, ThingSpeak.

All the best,

Ángela

just use webread instead of webwrite:

resource = 'http://industrial.api.ubidots.com/api/v1.6/devices/matlab?token=your-token'
response = webread(resource)

Source:
https://www.mathworks.com/help/matlab/ref/webread.html

1 Like

@jotathebest, thanks for your comment and direction. To complement your answer, the resource URL to retrieve variable data should be as follows:

resource = 'http://industrial.api.ubidots.com/api/v1.6/devices/matlab/<variable-label>/values?token=your-token'

@DIEGO21 bear in mind that you’ll need to replace <variable-label> with an actual variable label of your matlab device. Also, it is worth mentioning that the /values endpoint will retrieve the last 100 Dots of the variable, so in order to further filter the request, please make use of the query params as explained here