MATLAB with Ubidots

Integrate the power of MATLABs with Ubidots

Sergio M avatar
Written by Sergio M
Updated over a week ago

Who doesn't love MATLAB? Many of us, engineers, remember feeling like superheros in university after coding simulations and equations that would have been impossible without it.

MATLAB has been constantly evolving and one of its nice contemporary features is its ability to connect to external web-services. 

Most APIs/web-services understand the HTTP protocol. Fortunately, our friends at Mathworks have included function to handle HTTP requests; here's the full documentation about it.

Sending MATLAB values to Ubidots

Let's use MATLAB's HTTP function to send this data to Ubidots:

  • Value: 44

  • Variable: Temperature

  • Device name: Matlab (as can be seen in ubidotsURL)

Your MATLAB code could then look something like this:

ubidotsURL = ''
data = 44;
data = struct('temperature', data);
options = weboptions('MediaType','application/json');
response = webwrite(ubidotsURL, data, options)

To use this example in your own program and Ubidots account, replace "your-token" with your Ubidots account token, "data" with the variable you wish to send, "temperature" with how you want to name the variable in Ubidots, and "matlab" with the device name you'd like to appear in your Ubidots account.

We hope you found this has been useful! Feel free to drop us a line if you have any questions regarding Ubidots.

Did this answer your question?