Main Content

MATLAB Visualizations App

Visualize data from a ThingSpeak™ channel using MATLAB® functions and toolboxes listed in Access MATLAB Add-On Toolboxes. You can view and explore data using interactive or static visualizations. You can also make the visualizations public and use the URL to embed them on websites. Create these interactive visualizations using the MATLAB Visualizations app:

  • Area plot

  • Line plot

  • Scatter plot

  • Stem plot

  • Plot with two stacked Y-axes

You also have access to many more display options from the MATLAB Plot Gallery.

Visualize Data with MATLAB

  1. Click Apps > MATLAB Visualizations.

  2. Click New to start your visualization.

  3. Select a template or an example with sample code, which you can run and explore the results.

  4. Click Create.

MATLAB Visualizations Settings

  • Name: Enter a unique name for your visualization. Press enter, or click outside the name box anytime you change the name and the stored name of your visualization is automatically updated.

  • MATLAB Code: Enter custom code, or modify the sample code with your data.

  • Create a public URL: Check this box to make this visualization public and generate a public URL to share your MATLAB visualization. If this box is checked, you can also add the visualization to the public view of your public channels.

  • AutoUpdate: Execute MATLAB code and update currently visible visualizations every five minutes. The visualizations you can automatically update include:

    • Visualizations added to the channel view

    • Visualizations opened in view mode

    This check box is visible only to users with a paid ThingSpeak license.

  • Save and Run: Click to save and run your visualization.

  • Save: Click to save your visualization without running the code. An asterisk on this button indicates unsaved changes.

  • MATLAB Plot Output: This field displays your visualization.

  • Output: This field displays the output of your code. Use it to debug and modify your code.

  • Clear Output: Click to clear the visualization and the output.

  • Display Settings: You can add the visualization to your channel view. Expand Add/Edit this Visualization to a Channel to see a list of your channels.

    • To add the visualization to the private channel view, select Private View.

    • To show the visualization on a public view of a channel, make sure that the channel is public, and enable Create a public URL. Then select Public View for the channels you want to see the visualization on.

    • To update your selections, click Save Display Settings. All selected channels are shown in the section Show on Channel(s).

  • Delete: Click to delete the visualization. Deleting a visualization also deletes it from your channel view.

  • My Channels (right side of page) See information about your saved channels, including:

    • Channel name

    • Channel ID

    • Access

    • Write and Read API Keys

    • Channel fields

  • Help (right side of page)

    • Documentation: Click this tab for more information on using the MATLAB Visualizations app

    • New Channel: Create a new channel to hold the value of your analyzed data. After you save this channel, you automatically return to the same visualization app page, and the new channel appears in the Channel Info list.

Sizing of MATLAB Visualizations

To size your MATLAB visualization, send an HTTP GET request to https://thingspeak.com/apps/matlab_visualizations/MATLAB_VIS_ID, replacing the MATLAB_VIS_ID with your MATLAB visualization ID.

Valid parameters include:

  • width (integer/string) — Width of the visualization, specified in pixels. (optional) The default width is 450 pixels. You can also pass 'auto' as an argument to change the visualization width and height to the width and height of the parent HTML element.

  • height (integer/string) — Height of the visualization, specified in pixels. (optional) The default height is 235 pixels. You can also pass 'auto' as an argument to change the visualization width and height to the width and height of the parent HTML element.

Note

The minimum and maximum values for width and height are 120 pixels and 5000 pixels respectively. If you provide only the height as an integer, width is calculated using the golden ratio 1.618 as height * 1.618. If you provide only the width as an integer, height is calculated as width / 1.618. If you apply the formula results to a width that is outside the minimum or maximum value, the visualization size defaults to 450 x 235 pixels.

Example of a GET request:

GET https://thingspeak.com/apps/matlab_visualizations/19889?width=1000&height=1200
This request displays the MATLAB visualization.

Limitations

  • You cannot use ThingSpeak MATLAB interactive visualization functions with static MATLAB plots in the same code. Also, you can call only one plot function for a given visualization.

  • Data written to ThingSpeak channels in MATLAB visualizations must adhere to the posting rate limitations. You could lose data if you try to write to a channel multiple times within the period allowed by your license.

New to MATLAB?

See Also

Functions

Related Examples

More About