Main Content

addToRunOnBoot

Add MATLAB function to Run-on-boot

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

Description

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

example

Examples

collapse all

To add a function to Run-on-boot:

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, see raspberrypi (Simulink).

Use the addToRunOnBoot function.

If the function is successfully added, it returns 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