Before you begin
- You have a Sift API key and your base URLs.
- You have the ID of the Run and the IDs of the Channels you want to export. One option is to find these in the Sift UI or by querying the
ListRunsandListChannelsendpoints.
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.-
Create a virtual environment
-
Install the required packages
Create a file named
requirements.txtin your working directory with the following contents:Creating aVersions:sift-stack-py0.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.requirements.txtfile as shown above, rather than installing packages individually, is recommended to avoid version mismatches as new releases ofsift-stack-pybecome available. With the virtual environment active, install from the file: -
Point MATLAB to your virtual environment
In the MATLAB Command Window, run:
Replace
/path/to/envwith the full path to the virtual environment you created. To find it, runwhich pythonin your terminal while the virtual environment is active. -
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:
-
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
.envfile in your current working directory.To confirm where the file was saved, runpwd. Then load the credentials:
Query Channel data
-
Initialize the client
Run the following in the MATLAB Command Window to connect to Sift:
-
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_timeandend_timeare 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, passstart_timeandend_time:arrow_resultis a Python dict where each key is a Channel name and the value is an Apache Arrow table. -
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
parquetreadconverts it into a format MATLAB understands. ReplaceYOUR_CHANNEL_NAMEwith the exact name of your Channel as it appears in Sift, for exampletemperature.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__tox__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
-
Submit the export job
Submit the job using client.data_export.export. See the
ExportOutputFormatreference for the accepted output format values. -
Wait for the job and download the result
Use
client.jobs.wait_and_downloadwithshow_progressset tofalseto avoid the progress bar conflict with MATLAB’s Command Window: -
Load the result into MATLAB
The exported file is saved to MATLAB’s current working directory. Run
dirto find the filename:Then load it:The column names include the full Run and Asset path, for examplerunName|assetName|temperature. To rename a column after loading:
Use the REST API via webread
Query Channel data
-
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
.envfile in your current working directory.To confirm where the file was saved, runpwd. Then load the credentials: -
Query Channel data
To query Channel data, call the
GetDataendpoint.endTime: This field is exclusive, so a sample that falls exactly at or afterendTimeis 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 extendingendTimeslightly past the boundary you actually want.sampleMs: SetsampleMsto0, 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), butGetDataonly supports LTTB; the other methods are not currently available through this endpoint.Pagination:GetDatareturns at mostpageSizevalues per request; see thepageSizereference for the exact limits and how they’re applied.If more data exists beyond the returned page, the response’snextPageTokenfield is non-empty and the result is truncated, not an error.Client libraries such assift-stack-pyhandle this pagination internally, but MATLAB’swebwritedoes not, so a manual REST call must loop onpageTokenitself to retrieve the full dataset, as shown above. The loop continues sending the same query with an updatedpageTokenuntilnextPageTokencomes back empty, which signals that all data has been retrieved.Skipping this loop, as in a singlewebwritecall, silently returns only the first page even when more data exists. -
Query multiple Channels
To query more than one Channel in a single request, add a
structto thequeriescell array for each Channel. The nested structure can be difficult to get right by hand, so it helps to build thestructin MATLAB first, then usejsonencodeto inspect the exact JSON it produces before sending it.Write thestructto a JSON file to confirm the nesting is correct before submitting it:If you build or edit the JSON file directly instead of constructing thestructin MATLAB, load it back in withjsondecodebefore submitting:Submit the request.webwriteaccepts thestructdirectly and encodes it to JSON internally, so the samequeryvariable used to inspect the file can be sent as is. A multichannel request is subject to the samepageSizelimit as a single-Channel request, so this uses the samepageTokenloop shown in the previous step: -
Load into a MATLAB timetable
Each page in
allResultscan contain data for more than one Channel. Group the values by Channel name across all pages, then build one timetable per Channel:matlab.lang.makeValidNameconverts Channel names such asADCS.RW_Speed_Yinto valid MATLAB field names (ADCS_RW_Speed_Y), since field names can’t contain periods. This same code works whetherallResultscame from a single-Channel or multichannel query, since it groups by however many Channels are actually present in the response.
Export data to file
-
Submit the export job
To export data to a file, call the
ExportDataandGetDownloadUrlendpoints.outputFormat:EXPORT_OUTPUT_FORMAT_CSVis an actual value that needs to be passed as-is, not a placeholder to replace with your own text. -
Retrieve the download link
-
Unzip and load into MATLAB
The ZIP contains a file with a name generated by Sift. The format matches the
outputFormatyou specified when submitting the job, for examplesift_data_export_2026-05-19_172841.csvfor 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 examplerunName|assetName|temperature. To rename a column after loading: