Main Content

addToRunOnBoot

AddMATLABfunction to Run-on-boot

Description

addToRunOnBoot(raspPiObj,'function_name1')adds a MATLAB®函数Run-on-boot。如果you add a function to Run-on-boot, the function automatically starts to run each time you restart the Raspberry Pi™ hardware.

Examples

collapse all

To add a function to Run-on-boot:

  1. Create a connection to the Raspberry Pi hardware.

    raspPiObj = raspberrypi('192.168.1.5','pi','raspberry')
    board.EnableRunOnBoot = true rasPiObj = raspberrypi with properties: Name: 'Raspberry Pi' DeviceAddress: '176.93.236.232' Username: 'pi' Password: '*********' BuildDir: '/home/pi' EnableRunOnBoot: 1 BuildAction: 'Build, load, and run'

    For more information on creating a connection to Raspberry Pi hardware, seeraspberrypi(Simulink Support Package for Raspberry Pi Hardware).

  2. Use theaddToRunOnBootfunction.

    If the function is successfully added, it returns the full path name of the function. Otherwise, it returns an empty cell.

    addRunOnBoot(raspPiObj,'/home/pi/MATLAB_ws/R2020a/L/work/raspberrypi_gettingstarted')
    ans = 1×1 cell array {'/home/pi/MATLAB_ws/R2020a/L/work/raspberrypi_gettingstarted'}

Input Arguments

collapse all

The object that represents the connection to Raspberry Pi hardware.

Example:raspPiObj

The full path of the MATLAB function to be added to Run-on-boot.

Example:'/home/pi/MATLAB_ws/R2020a/L/work/raspberrypi_gettingstarted'

Data Types:char

Version History

Introduced in R2019b