Skip to main content
After completing this workflow, you can bring Channel data from Sift into MATLAB and load it into a timetable or table ready for analysis. After data is stored in Sift, it can be exported into MATLAB for analysis. Sift recommends using the official Python client via MATLAB’s built-in Python interface. If your team cannot use Python, the REST API is also supported natively from MATLAB.

Before you begin

How exporting to MATLAB works

Sift provides two programmatic export methods: data querying, which returns Channel data immediately in the response, and export data to file, which processes the export in the background and produces a downloadable file. Both methods are available through either the Python client or the REST API, the two options for importing data into MATLAB.

Use the Python client via MATLAB’s Python interface

Set up the Python environment

The Python client requires Python 3.8 or later installed on the same machine as MATLAB. Both methods below rely on the Sift Python client running inside a Python virtual environment that MATLAB can access. Complete the following steps once before running either method. This sets up the Python environment, points MATLAB to it, and stores your Sift credentials.
  1. Create a virtual environment
  2. Install the required packages Create a file named requirements.txt in your working directory with the following contents:
    Versions: sift-stack-py 0.18.0 is the latest release as of this guide’s last update. If a newer version is available by the time you’re reading this, it likely works as well, but hasn’t been verified against this guide.
    Creating a requirements.txt file as shown above, rather than installing packages individually, is recommended to avoid version mismatches as new releases of sift-stack-py become available. With the virtual environment active, install from the file:
  3. Point MATLAB to your virtual environment In the MATLAB Command Window, run:
    Replace /path/to/env with the full path to the virtual environment you created. To find it, run which python in your terminal while the virtual environment is active.
  4. Verify your Python environment In MATLAB, confirm that the correct Python environment is being used:
    If the wrong environment is selected, point MATLAB at the correct one:
  5. Set your Sift credentials Replace the placeholder values below with your actual credentials, then run the following in the MATLAB Command Window. This creates a .env file in your current working directory.
    To confirm where the file was saved, run pwd. Then load the credentials:

Query Channel data

  1. Initialize the client Run the following in the MATLAB Command Window to connect to Sift:
  2. List Channels and query data Use client.runs.find to find a single Run by name, or client.runs.list_ to search across multiple Runs. When a Run is provided to client.channels.get_data_as_arrow, the Run’s time range is used automatically so start_time and end_time are not needed. Find the Run. Use Approach 1 to find a single Run by name:
    Use Approach 2 to search across multiple Runs:
    Find Channels scoped to the Run using client.channels.list_:
    If you already know the Channel ID, you can use client.channels.get instead:
    Query data for the full Run:
    To query a specific time window within the Run, pass start_time and end_time:
    arrow_result is a Python dict where each key is a Channel name and the value is an Apache Arrow table.
  3. Write to Parquet and load into MATLAB Data returned by get_data_as_arrow comes back as a Python object that MATLAB cannot consume directly. Writing it to a Parquet file and loading it with parquetread converts it into a format MATLAB understands. Replace YOUR_CHANNEL_NAME with the exact name of your Channel as it appears in Sift, for example temperature.
    The output will look similar to this:
    You will see a warning about table variable names being modified. This is expected. MATLAB automatically renames the internal timestamp column from __index_level_0__ to x__index_level_0__ to comply with MATLAB identifier rules. The timetable is created correctly and the warning can be safely ignored.

Export data to file

  1. Submit the export job Submit the job using client.data_export.export. See the ExportOutputFormat reference for the accepted output format values.
  2. Wait for the job and download the result Use client.jobs.wait_and_download with show_progress set to false to avoid the progress bar conflict with MATLAB’s Command Window:
  3. Load the result into MATLAB The exported file is saved to MATLAB’s current working directory. Run dir to find the filename:
    Then load it:
    The column names include the full Run and Asset path, for example runName|assetName|temperature. To rename a column after loading:

Use the REST API via webread

Query Channel data

  1. Set your Sift credentials Replace the placeholder values below with your actual credentials, then run the following in the MATLAB Command Window. This creates a .env file in your current working directory.
    To confirm where the file was saved, run pwd. Then load the credentials:
  2. Query Channel data To query Channel data, call the GetData endpoint.
    endTime: This field is exclusive, so a sample that falls exactly at or after endTime is not included in the response. If a value you expect to see is missing, or the last row in MATLAB doesn’t match what the Sift app shows for the same time range, try extending endTime slightly past the boundary you actually want.
    sampleMs: Set sampleMs to 0, or omit it, to return the full, unsampled dataset, recommended for external data analysis. Any other value downsamples the response using LTTB, a shape-preserving algorithm intended for plotting rather than analysis; it returns approximately one representative point per that many milliseconds rather than sampling at a literal fixed interval.
    Timeseries Panel: The Sift app’s Timeseries Panel offers a choice of sampling methods (LTTB, Min/Max, and Changed Only), but GetData only supports LTTB; the other methods are not currently available through this endpoint.
    Pagination: GetData returns at most pageSize values per request; see the pageSize reference for the exact limits and how they’re applied.If more data exists beyond the returned page, the response’s nextPageToken field is non-empty and the result is truncated, not an error.Client libraries such as sift-stack-py handle this pagination internally, but MATLAB’s webwrite does not, so a manual REST call must loop on pageToken itself to retrieve the full dataset, as shown above. The loop continues sending the same query with an updated pageToken until nextPageToken comes back empty, which signals that all data has been retrieved.Skipping this loop, as in a single webwrite call, silently returns only the first page even when more data exists.
  3. Query multiple Channels To query more than one Channel in a single request, add a struct to the queries cell array for each Channel. The nested structure can be difficult to get right by hand, so it helps to build the struct in MATLAB first, then use jsonencode to inspect the exact JSON it produces before sending it.
    Write the struct to a JSON file to confirm the nesting is correct before submitting it:
    If you build or edit the JSON file directly instead of constructing the struct in MATLAB, load it back in with jsondecode before submitting:
    Submit the request. webwrite accepts the struct directly and encodes it to JSON internally, so the same query variable used to inspect the file can be sent as is. A multichannel request is subject to the same pageSize limit as a single-Channel request, so this uses the same pageToken loop shown in the previous step:
  4. Load into a MATLAB timetable Each page in allResults can contain data for more than one Channel. Group the values by Channel name across all pages, then build one timetable per Channel:
    matlab.lang.makeValidName converts Channel names such as ADCS.RW_Speed_Y into valid MATLAB field names (ADCS_RW_Speed_Y), since field names can’t contain periods. This same code works whether allResults came from a single-Channel or multichannel query, since it groups by however many Channels are actually present in the response.

Export data to file

  1. Submit the export job To export data to a file, call the ExportData and GetDownloadUrl endpoints.
    outputFormat: EXPORT_OUTPUT_FORMAT_CSV is an actual value that needs to be passed as-is, not a placeholder to replace with your own text.
  2. Retrieve the download link
  3. Unzip and load into MATLAB
    The ZIP contains a file with a name generated by Sift. The format matches the outputFormat you specified when submitting the job, for example sift_data_export_2026-05-19_172841.csv for CSV. Run the following to see the exact filename:
    Then load it using the actual filename:
    The column names include the full Run and Asset path, for example runName|assetName|temperature. To rename a column after loading:

Reference