Main Content

target.Command class

Package: target

Capture system command for execution on MATLAB computer

Since R2020b

Description

Use the target.Command class to capture a system command for execution on your development computer.

To create a target.Command object, use the target.create function. Create the object and then use separate steps to specify properties. Or, create the object and specify properties in a single step.

commandObject = target.create('Command', ...
                              stringPropertyValue, ...
                              argumentsPropertyValue) 

Properties

expand all

Name of the application or script to call.

Attributes:

GetAccess
public
SetAccess
public

String array or cell array of character vectors where each element represents a separate argument to the application or script defined in the String property.

Attributes:

GetAccess
public
SetAccess
public

Examples

collapse all

Create this target.Command object by providing an application file path and arguments for the application.

cmdObj= target.create('Command');
cmdObj.String = 'pathToavrdude';
cmdObj.Arguments = {'-p$(BOARD.Processor.ArduinoPartNumber)' ...
                    '-c$(PROCESSOR.ArduinoProgrammer)' ...
                    '-Uflash:w:$(EXE):i'};

You can create the object in a single step.

cmdObj = target.create('Command', ...
                       'pathToavrdude', ...
                       {'-p$(BOARD.Processor.ArduinoPartNumber)' ...
                       '-c$(PROCESSOR.ArduinoProgrammer)' ...
                       '-Uflash:w:$(EXE):i'});

You can also specify the command and arguments by using a string. For example, to create a target.Command object for the command echo with arguments -a and -b, run:

cmdObj = target.create('Command', 'echo -a -b');

Version History

Introduced in R2020b