Main Content

targetHardware

Configuration object for hardware

Add-On Required: This feature requires the MATLAB Support Package for Raspberry Pi Hardware add-on.

Description

This object represents a configuration object for the hardware. Create this object by using the targetHardware function. Use this object with the deploy function to deploy a MATLAB® function as a standalone executable on the hardware.

Creation

Description

targetObj = targetHardware(hardwareName) creates a configuration object for the hardware. You can deploy your MATLAB function as a standalone executable on the hardware by using this object with the deploy method.

example

Input Arguments

expand all

Name of the hardware on which the MATLAB function is to be deployed.

Example: 'Raspberry Pi'

Data Types: char

Output Arguments

expand all

The configuration object of the specified hardware, returned as a targetHardware object.

Properties

expand all

This property is read-only.

The name of the hardware on which the MATLAB function is to be deployed.

Example: Raspberry Pi

Data Types: char

The IP address or host name of the Ethernet port on the hardware. In MATLAB Online™, DeviceAddress is the SerialNumber of the hardware as displayed by raspilist.

Example: 169.254.0.2

Data Types: char

The user name for the Linux® operating system on the hardware.

Example: pi

Data Types: char

The password for the Linux operating system on the hardware.

Note

The default user is pi, and the password is raspberry. This user has sudo root powers at the command line. Changing this default password to a stronger password is a good security practice.

Example: raspberry

Data Types: char

The folder on the hardware where the MATLAB function is deployed. This folder contains a symbolic link to the deployed executable. For example, if you specify BuildDir as /home/pi, the support package adds a folder structure, /MATLAB_ws/R2020a, inside your BuildDir, where MATLAB_ws is the workspace directory and R2020a is the release version of MATLAB. This folder contains a symbolic link that points to the actual location of the deployed executable.

Example: /home/pi

Data Types: char

Defines how MATLAB responds when you press Ctrl+B to build your model.

  • Build: MATLAB compiles and links the MATLAB function into an executable with libraries. This option does not load and run the executable on the hardware board.

  • Build, load, and run: MATLAB compiles and links the MATLAB function into an executable with libraries, loads the executable and libraries, and runs the executable on the hardware.

Example: Build, load, and run

Data Types: char

Object Functions

deployDeploy MATLAB function on hardware

Examples

collapse all

Note

This example is applicable to the installed MATLAB Support Package for Raspberry Pi® Hardware.

Create a configuration object of the Raspberry Pi hardware.

targetObj = targetHardware('Raspberry Pi')
targetObj = 
 targetHardware with properties:

               Name: 'Raspberry Pi'
      DeviceAddress: '172.18.182.234'
           Username: 'pi'
           Password: '*********'
           BuildDir: '/home/pi'
    EnableRunOnBoot: 0
        BuildAction: 'Build, load, and run'
        CoderConfig: [1×1 coder.CodeConfig]

Create a configuration object of the Raspberry Pi hardware in MATLAB Online

targetObj = targetHardware('Raspberry Pi')
board =
 
targetHardware with properties:
 
               Name: 'Raspberry Pi'
      DeviceAddress: '0000000096843414'
           Username: ''
           Password: ''
           BuildDir: '/home/matlabrpi'
    EnableRunOnBoot: 0
        BuildAction: 'Build, load, and run'
        CoderConfig: [1x1 coder.CodeConfig]

Extended Capabilities

Version History

Introduced in R2018b

See Also