getMATFilesFromPixhawk
Add-On Required: This feature requires the UAV Toolbox Support Package for PX4 Autopilots add-on.
Description
getMATFilesFromPixhawk(
retrieves
MAT-files corresponding to the model name, specified as an argument, from the SD card
inserted on the Pixhawk® hardware board.modelname
)
Note
To work with this function, you need to enable MAVLink in the Simulink® model for which the MAT-files are generated. For details, see Enable MAVLink.
getMATFilesFromPixhawk(
retrieves MAT-files from the SD card based on the options specified by one or more
modelname
,Name,Value
)Name,Value
pair arguments.
Examples
Retrieve MAT-files
Retrieve all MAT-files that are generated as part of the latest run (the MAT-files that are generated after you last clicked Build, Deploy & Start in Simulink).
Consider that the file name of the Simulink model that is configured for MAT-file logging is
px4_squarepath_sdcard
. This Simulink model is deployed to the Pixhawk hardware three times, and you want to retrieve files only from the latest
run.
To do this, enter the following command at the MATLAB® command prompt after the model has successfully run on the hardware:
getMATFilesFromPixhawk(px4_squarepath_sdcard)
After the above function is run, only the files from the latest (third) run are copied to the current folder in MATLAB. For example, the file names of the retrieved files in the current folder look like this:
px4_squarepath_sdcard_3_1.mat px4_squarepath_sdcard_3_2.mat px4_squarepath_sdcard_3_3.mat
The suffix 3
just after the model name represents the run
number.
Specify Options and Retrieve MAT-files
Retrieve MAT-files by specifying options as name-value pairs.
Consider that the file name of the Simulink model that is configured for MAT-file logging is
px4_squarepath_sdcard
. This Simulink model is deployed to the Pixhawk hardware three times, and you want to retrieve all files from all the
successful runs, and also delete all the files from SD card after retrieving the
files.
To do this, enter the following command at the MATLAB command prompt:
getMATFilesFromPixhawk(px4_squarepath_sdcard,'ExtractFilesFromAllRuns',true,'DeleteAfterRetrieval',true)
After the above function is run, all the files from all the successful runs are copied to the current folder in MATLAB, and they are also deleted from the SD card. For example, the file names of the retrieved files in the current folder look like this:
px4_squarepath_sdcard_1_1.mat px4_squarepath_sdcard_1_2.mat px4_squarepath_sdcard_1_3.mat px4_squarepath_sdcard_2_1.mat px4_squarepath_sdcard_2_2.mat px4_squarepath_sdcard_2_3.mat px4_squarepath_sdcard_3_1.mat px4_squarepath_sdcard_3_2.mat px4_squarepath_sdcard_3_3.mat
Input Arguments
modelname
— File name of the Simulink model
character vector
File name of the Simulink model that is configured for MAT-file logging and deployed on the Pixhawk hardware board with SD card inserted.
Name-Value Arguments
Specify optional pairs of arguments as
Name1=Value1,...,NameN=ValueN
, where Name
is
the argument name and Value
is the corresponding value.
Name-value arguments must appear after other arguments, but the order of the
pairs does not matter.
Before R2021a, use commas to separate each name and value, and enclose
Name
in quotes.
Example:
ExtractFilesFromAllRuns
— Extract MAT-files from SD card for all runs
false (default) | true
Extract all the MAT-files from the SD card inserted on the Pixhawk hardware, for all runs (for all successful Build, Deploy & Start actions)
Example: getMATFilesFromPixhawk(px4_squarepath_sdcard,'ExtractFilesFromAllRuns',true)
Data Types: logical
DeleteAfterRetrieval
— Delete the MAT-files that are retrieved from SD card
false (default) | true
Delete the MAT-files that are retrieved from the SD card inserted on the Pixhawk hardware, after successful retrieval of the files.
Tip
Set the value of DeleteAfterRetrieval
to
true
always because this will reduce the time taken to
retrieve the MAT-Files from SD card next time.
Example: getMATFilesFromPixhawk(px4_squarepath_sdcard,'DeleteAfterRetrieval',true)
Data Types: logical
COMPort
— The COM Port of the host computer to which the Pixhawk hardware board is connected
character vector | string scalar
The COM Port of the host computer to which the Pixhawk hardware board is connected to retrieve the MAT-files, specified as a character vector or string.
Note
This name-value pair is generally used if you select PX4 Pixhawk
Series
as the Hardware board. For all other boards such as
PX4 Pixhawk 1
, the COM port is determined
automatically unless you specify the COM port as part of this name-value
pair.
Example: getMATFilesFromPixhawk(px4_squarepath_sdcard,'DeleteAfterRetrieval',true,'COMPort','COM15')
Data Types: char
| string
Version History
Introduced in R2020b
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)